html_url
stringlengths
48
51
title
stringlengths
5
268
comments
stringlengths
63
51.8k
body
stringlengths
0
36.2k
comment_length
int64
16
1.52k
text
stringlengths
164
54.1k
embeddings
sequence
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
This seems to be on the `transformers` library side. If you have more informations (pip env) or even better, a colab reproducing the error we can investigate.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
27
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. This seems to be on the `transformers` library side. If you have more informations (pip env) or even better, a colab reproducing the error we can investigate.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
It seems like it's solved with freshed versions of transformers. I have tried to replicate the error doing a fresh pip install transformers & datasets on colab and the error doesn't continue. On colab it keeps stable on 5GB! (Y) Edit: **Thanks for your great work**. Have a good day.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
50
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. It seems like it's solved with freshed versions of transformers. I have tried to replicate the error doing a fresh pip install transformers & datasets on colab and the error doesn't continue. On colab it keeps stable on 5GB! (Y) Edit: **Thanks for your great work**. Have a good day.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
@gaceladri witch version transformers and datasets are you using now? I want to try again. Thanks.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
16
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. @gaceladri witch version transformers and datasets are you using now? I want to try again. Thanks.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
It's happening to me again. After 4 hours of pre-training, my ram memory gets full and the kernel dies. I am using the last transformers version as today. 4.4.0 and the last version of datasets 1.2.1, both installed from master. The memory consumption keeps increasing.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
45
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. It's happening to me again. After 4 hours of pre-training, my ram memory gets full and the kernel dies. I am using the last transformers version as today. 4.4.0 and the last version of datasets 1.2.1, both installed from master. The memory consumption keeps increasing.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
Thanks for the investigation @gaceladri Apparently this happens when `num_workers>0` and has to do with objects being copied-on-write. Did you try setting num_workers to 0 @gaceladri ? If the issue doesn't happen with `num_workers=0` then this would confirm that it's indeed related to this python/pytorch issue. Since a `Dataset` object is a wrapper of a pyarrow Table, we should investigate if the data being copied comes from the Table itself or from metadata in the `Dataset` object. If it comes from the metadata in the `Dataset` object, we should be able to implement a workaround. But if it comes from the Table, we'll need to see with the pyarrow team what we can do...
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
114
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. Thanks for the investigation @gaceladri Apparently this happens when `num_workers>0` and has to do with objects being copied-on-write. Did you try setting num_workers to 0 @gaceladri ? If the issue doesn't happen with `num_workers=0` then this would confirm that it's indeed related to this python/pytorch issue. Since a `Dataset` object is a wrapper of a pyarrow Table, we should investigate if the data being copied comes from the Table itself or from metadata in the `Dataset` object. If it comes from the metadata in the `Dataset` object, we should be able to implement a workaround. But if it comes from the Table, we'll need to see with the pyarrow team what we can do...
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
Hmmm so this might come from another issue... Since it doesn't seem to be related to multiprocessing it should be easier to investigate though. Do you have some ideas @gaceladri ?
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
31
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. Hmmm so this might come from another issue... Since it doesn't seem to be related to multiprocessing it should be easier to investigate though. Do you have some ideas @gaceladri ?
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
@lhoestq I looked quickly to a previously spoted bug in my env wandb /sdk/interface/interface.py, because sometimes when I load the dataset I got a multiprocessing error at line 510 in wandb...interface.py This bug is reported here https://github.com/huggingface/datasets/issues/847 ``` --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <timed eval> in <module> ~/anaconda3/envs/tfm/lib/python3.6/site-packages/transformers/trainer.py in train(self, model_path, trial) 877 print(len(epoch_iterator)) 878 --> 879 for step, inputs in enumerate(epoch_iterator): 880 881 start_step = time.time() ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in __next__(self) 433 if self._sampler_iter is None: 434 self._reset() --> 435 data = self._next_data() 436 self._num_yielded += 1 437 if self._dataset_kind == _DatasetKind.Iterable and \ ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _next_data(self) 1083 else: 1084 del self._task_info[idx] -> 1085 return self._process_data(data) 1086 1087 def _try_put_index(self): ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _process_data(self, data) 1109 self._try_put_index() 1110 if isinstance(data, ExceptionWrapper): -> 1111 data.reraise() 1112 return data 1113 ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/_utils.py in reraise(self) 426 # have message field 427 raise self.exc_type(message=msg) --> 428 raise self.exc_type(msg) 429 430 AssertionError: Caught AssertionError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1083, in __getitem__ format_kwargs=self._format_kwargs, File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1070, in _getitem format_kwargs=format_kwargs, File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 886, in _convert_outputs v = map_nested(command, v, **map_nested_kwargs) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/utils/py_utils.py", line 216, in map_nested return function(data_struct) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 847, in command return torch.tensor(x, **format_kwargs) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 101, in _showwarnmsg _showwarnmsg_impl(msg) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 30, in _showwarnmsg_impl file.write(text) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/lib/redirect.py", line 100, in new_write cb(name, data) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/wandb_run.py", line 729, in _console_callback self._backend.interface.publish_output(name, data) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 186, in publish_output self._publish_output(o) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 191, in _publish_output self._publish(rec) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 510, in _publish if self._process and not self._process.is_alive(): File "/home/ad/anaconda3/envs/tfm/lib/python3.6/multiprocessing/process.py", line 134, in is_alive assert self._parent_pid == os.getpid(), 'can only test a child process' AssertionError: can only test a child process ``` My workaround was to just comment those lines without looking to much into consecuences: ``` def _publish(self, record: pb.Record, local: bool = None) -> None: #if self._process and not self._process.is_alive(): # raise Exception("The wandb backend process has shutdown") ``` It worked so far... I need to try running without wandb and see if it could be causing something wrong with multiprocessing. I am going to try to launch the training setting wandb to false and I will let you know again.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
396
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. @lhoestq I looked quickly to a previously spoted bug in my env wandb /sdk/interface/interface.py, because sometimes when I load the dataset I got a multiprocessing error at line 510 in wandb...interface.py This bug is reported here https://github.com/huggingface/datasets/issues/847 ``` --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <timed eval> in <module> ~/anaconda3/envs/tfm/lib/python3.6/site-packages/transformers/trainer.py in train(self, model_path, trial) 877 print(len(epoch_iterator)) 878 --> 879 for step, inputs in enumerate(epoch_iterator): 880 881 start_step = time.time() ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in __next__(self) 433 if self._sampler_iter is None: 434 self._reset() --> 435 data = self._next_data() 436 self._num_yielded += 1 437 if self._dataset_kind == _DatasetKind.Iterable and \ ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _next_data(self) 1083 else: 1084 del self._task_info[idx] -> 1085 return self._process_data(data) 1086 1087 def _try_put_index(self): ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _process_data(self, data) 1109 self._try_put_index() 1110 if isinstance(data, ExceptionWrapper): -> 1111 data.reraise() 1112 return data 1113 ~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/_utils.py in reraise(self) 426 # have message field 427 raise self.exc_type(message=msg) --> 428 raise self.exc_type(msg) 429 430 AssertionError: Caught AssertionError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1083, in __getitem__ format_kwargs=self._format_kwargs, File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1070, in _getitem format_kwargs=format_kwargs, File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 886, in _convert_outputs v = map_nested(command, v, **map_nested_kwargs) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/utils/py_utils.py", line 216, in map_nested return function(data_struct) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 847, in command return torch.tensor(x, **format_kwargs) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 101, in _showwarnmsg _showwarnmsg_impl(msg) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 30, in _showwarnmsg_impl file.write(text) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/lib/redirect.py", line 100, in new_write cb(name, data) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/wandb_run.py", line 729, in _console_callback self._backend.interface.publish_output(name, data) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 186, in publish_output self._publish_output(o) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 191, in _publish_output self._publish(rec) File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 510, in _publish if self._process and not self._process.is_alive(): File "/home/ad/anaconda3/envs/tfm/lib/python3.6/multiprocessing/process.py", line 134, in is_alive assert self._parent_pid == os.getpid(), 'can only test a child process' AssertionError: can only test a child process ``` My workaround was to just comment those lines without looking to much into consecuences: ``` def _publish(self, record: pb.Record, local: bool = None) -> None: #if self._process and not self._process.is_alive(): # raise Exception("The wandb backend process has shutdown") ``` It worked so far... I need to try running without wandb and see if it could be causing something wrong with multiprocessing. I am going to try to launch the training setting wandb to false and I will let you know again.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
@lhoestq But despite this, I got lost into the [class Dataset()](https://huggingface.co/docs/datasets/_modules/datasets/arrow_dataset.html#Dataset) reading the pyarrow files. Edit: but you should be rigth, that it does not have to be related to multiprocessing since it keeps happening when `num_workers=0`
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
37
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. @lhoestq But despite this, I got lost into the [class Dataset()](https://huggingface.co/docs/datasets/_modules/datasets/arrow_dataset.html#Dataset) reading the pyarrow files. Edit: but you should be rigth, that it does not have to be related to multiprocessing since it keeps happening when `num_workers=0`
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
Or maybe wandb uses multiprocessing ? One process for wandb logging and one for actual training ? If this is the case then even setting `num_workers=0` would cause the process to be forked for wandb and therefore cause the memory issue.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
41
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. Or maybe wandb uses multiprocessing ? One process for wandb logging and one for actual training ? If this is the case then even setting `num_workers=0` would cause the process to be forked for wandb and therefore cause the memory issue.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
@lhoestq could be, but if we set wandb to false this should not happen. I am going to try.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
19
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. @lhoestq could be, but if we set wandb to false this should not happen. I am going to try.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
@lhoestq It keeps happening. I have uninstalled wandb from my env, setted `%env WANDB_DISABLED=true` on my notebook, and commented this func: ``` def get_available_reporting_integrations(): integrations = [] if is_azureml_available(): integrations.append("azure_ml") if is_comet_available(): integrations.append("comet_ml") if is_mlflow_available(): integrations.append("mlflow") if is_tensorboard_available(): integrations.append("tensorboard") # if is_wandb_available(): # integrations.append("wandb") return integrations ``` As a fast test and it keeps increasing the ram memory. Wandb could not be the blameworthy here.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
65
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. @lhoestq It keeps happening. I have uninstalled wandb from my env, setted `%env WANDB_DISABLED=true` on my notebook, and commented this func: ``` def get_available_reporting_integrations(): integrations = [] if is_azureml_available(): integrations.append("azure_ml") if is_comet_available(): integrations.append("comet_ml") if is_mlflow_available(): integrations.append("mlflow") if is_tensorboard_available(): integrations.append("tensorboard") # if is_wandb_available(): # integrations.append("wandb") return integrations ``` As a fast test and it keeps increasing the ram memory. Wandb could not be the blameworthy here.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
Thanks for checking @gaceladri . Let's investigate the single process setting then. If you have some sort of colab notebook with a minimal code example that shows this behavior feel free to share it @gaceladri so that we can play around with it to find what causes this. Otherwise I'll probably try to reproduce on my side at one point
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
60
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. Thanks for checking @gaceladri . Let's investigate the single process setting then. If you have some sort of colab notebook with a minimal code example that shows this behavior feel free to share it @gaceladri so that we can play around with it to find what causes this. Otherwise I'll probably try to reproduce on my side at one point
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
@lhoestq sure. Here you have https://colab.research.google.com/drive/1ba09ZOpyHGAOQLcsxiQAHRXl10qnMU5o?usp=sharing let me know if the link works and it reproduces the issue. To me, it reproduces the issue, since if you start the training the ram memory keeps increasing. Let me know. Thanks!
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
39
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. @lhoestq sure. Here you have https://colab.research.google.com/drive/1ba09ZOpyHGAOQLcsxiQAHRXl10qnMU5o?usp=sharing let me know if the link works and it reproduces the issue. To me, it reproduces the issue, since if you start the training the ram memory keeps increasing. Let me know. Thanks!
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
Could the bug be comming from tokenizers? I got this warning at the terminal from my jupyter notebook: ``` huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks... To disable this warning, you can either: - Avoid using `tokenizers` before the fork if possible - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false) ```
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
63
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. Could the bug be comming from tokenizers? I got this warning at the terminal from my jupyter notebook: ``` huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks... To disable this warning, you can either: - Avoid using `tokenizers` before the fork if possible - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false) ```
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
I've never experienced memory issues with tokenizers so I don't know Cc @n1t0 are you aware of any issue that would cause memory to keep increasing when the tokenizer is used in the Data Collator for language modeling ?
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
39
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. I've never experienced memory issues with tokenizers so I don't know Cc @n1t0 are you aware of any issue that would cause memory to keep increasing when the tokenizer is used in the Data Collator for language modeling ?
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
@lhoestq Thanks for pointing to n1t0, just to clarify. That warning was doing fine-tuning, without collator: ``` from datasets import load_dataset, load_metric import numpy as np GLUE_TASKS = [ "cola", "mnli", "mnli-mm", "mrpc", "qnli", "qqp", "rte", "sst2", "stsb", "wnli", ] task = "mnli" actual_task = "mnli" if task == "mnli-mm" else task dataset = load_dataset("glue", actual_task) metric = load_metric("glue", actual_task) batch_size = 16 attention_type = "linear" from transformers.models.mobilebert_mod import ( MobileBertForSequenceClassification, MobileBertTokenizerFast, ) from transformers.models.mobilebert_mod.configuration_mobilebert import ( MobileBertConfigMod, ) from transformers import TrainingArguments, Trainer num_labels = 3 if task.startswith("mnli") else 1 if task == "stsb" else 2 tokenizer = MobileBertTokenizerFast.from_pretrained( "/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/", max_len=512, ) model = MobileBertForSequenceClassification.from_pretrained( "/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/", num_labels=num_labels, ) print(model.num_parameters()) task_to_keys = { "cola": ("sentence", None), "mnli": ("premise", "hypothesis"), "mnli-mm": ("premise", "hypothesis"), "mrpc": ("sentence1", "sentence2"), "qnli": ("question", "sentence"), "qqp": ("question1", "question2"), "rte": ("sentence1", "sentence2"), "sst2": ("sentence", None), "stsb": ("sentence1", "sentence2"), "wnli": ("sentence1", "sentence2"), } sentence1_key, sentence2_key = task_to_keys[task] if sentence2_key is None: print(f"Sentence: {dataset['train'][0][sentence1_key]}") else: print(f"Sentence 1: {dataset['train'][0][sentence1_key]}") print(f"Sentence 2: {dataset['train'][0][sentence2_key]}") def preprocess_function(examples): if sentence2_key is None: return tokenizer(examples[sentence1_key], truncation=True) return tokenizer(examples[sentence1_key], examples[sentence2_key], truncation=True) encoded_dataset = dataset.map(preprocess_function, batched=True) metric_name = ( "pearson" if task == "stsb" else "matthews_correlation" if task == "cola" else "accuracy" ) args = TrainingArguments( f"test-glue/{task}_{attention_type}", evaluation_strategy="steps", learning_rate=1e-5, per_device_train_batch_size=batch_size, per_device_eval_batch_size=batch_size, logging_steps=200, num_train_epochs=5, gradient_accumulation_steps=1, warmup_steps=10000, fp16=True, dataloader_num_workers=10, weight_decay=0.1, load_best_model_at_end=True, metric_for_best_model=metric_name, ) def compute_metrics(eval_pred): predictions, labels = eval_pred if task != "stsb": predictions = np.argmax(predictions, axis=1) else: predictions = predictions[:, 0] return metric.compute(predictions=predictions, references=labels) validation_key = ( "validation_mismatched" if task == "mnli-mm" else "validation_matched" if task == "mnli" else "validation" ) trainer = Trainer( model, args, train_dataset=encoded_dataset["train"], eval_dataset=encoded_dataset[validation_key], tokenizer=tokenizer, compute_metrics=compute_metrics, ) trainer.train() ``` Now, I have come back to pre-training. The changes that I think I have done are: not formatting the dataset to torch: ~~`big_dataset.set_format(type='torch', columns=["text", "input_ids", "attention_mask", "token_type_ids"])`~~ so maybe some column is dropped and not freezed in memory and now I have not setted any validation dataset in the trainer. My validation dataset before: ``` book_corpus_eval = load_dataset( "bookcorpus", "plain_text", cache_dir="/home/ad/Desktop/bookcorpus", split="train[98:99%]", ) book_corpus_eval = book_corpus_eval.map(encode, batched=True) book_corpus_eval.set_format( type="torch", columns=["text", "input_ids", "attention_mask", "token_type_ids"] ) **book_corpus_eval = book_corpus_eval.select([i for i in range(1500)])** ``` Maybe _selecting_ or indexing the dataset before feeding it to the trainer, do something strange. My trainer now: ``` big_dataset = load_from_disk("/home/ad/Desktop/35percent_data.arrow/") from transformers import DataCollatorForWholeWordMask data_collator = DataCollatorForWholeWordMask( tokenizer=tokenizer, mlm=True, mlm_probability=0.15) from transformers import Trainer, TrainingArguments training_args = TrainingArguments( output_dir="./big_linear_layerdrop_shared_silu_secondtry", overwrite_output_dir=True, per_device_train_batch_size=60, per_device_eval_batch_size=60, save_steps=500, save_total_limit=10, logging_first_step=True, logging_steps=100, # evaluation_strategy='steps', # eval_steps=250, gradient_accumulation_steps=8, fp16=True, dataloader_num_workers=10, warmup_steps=15000, learning_rate=6e-4, adam_epsilon=1e-6, adam_beta2=0.98, weight_decay=0.01, max_grad_norm=1.0, max_steps=500000, ) trainer = Trainer( model=model, args=training_args, data_collator=data_collator, train_dataset=big_dataset, # eval_dataset=book_corpus_eval, tokenizer=tokenizer) import wandb wandb.login() trainer.train() ``` And surprisingly, the ram now keeps going up and down. The training is up now for 12h without collapse the ram. I don't know what could cause the leakage. :mag: Edit: I didn't see the swap memory, that keeps increasing. So the problem persist.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
468
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. @lhoestq Thanks for pointing to n1t0, just to clarify. That warning was doing fine-tuning, without collator: ``` from datasets import load_dataset, load_metric import numpy as np GLUE_TASKS = [ "cola", "mnli", "mnli-mm", "mrpc", "qnli", "qqp", "rte", "sst2", "stsb", "wnli", ] task = "mnli" actual_task = "mnli" if task == "mnli-mm" else task dataset = load_dataset("glue", actual_task) metric = load_metric("glue", actual_task) batch_size = 16 attention_type = "linear" from transformers.models.mobilebert_mod import ( MobileBertForSequenceClassification, MobileBertTokenizerFast, ) from transformers.models.mobilebert_mod.configuration_mobilebert import ( MobileBertConfigMod, ) from transformers import TrainingArguments, Trainer num_labels = 3 if task.startswith("mnli") else 1 if task == "stsb" else 2 tokenizer = MobileBertTokenizerFast.from_pretrained( "/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/", max_len=512, ) model = MobileBertForSequenceClassification.from_pretrained( "/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/", num_labels=num_labels, ) print(model.num_parameters()) task_to_keys = { "cola": ("sentence", None), "mnli": ("premise", "hypothesis"), "mnli-mm": ("premise", "hypothesis"), "mrpc": ("sentence1", "sentence2"), "qnli": ("question", "sentence"), "qqp": ("question1", "question2"), "rte": ("sentence1", "sentence2"), "sst2": ("sentence", None), "stsb": ("sentence1", "sentence2"), "wnli": ("sentence1", "sentence2"), } sentence1_key, sentence2_key = task_to_keys[task] if sentence2_key is None: print(f"Sentence: {dataset['train'][0][sentence1_key]}") else: print(f"Sentence 1: {dataset['train'][0][sentence1_key]}") print(f"Sentence 2: {dataset['train'][0][sentence2_key]}") def preprocess_function(examples): if sentence2_key is None: return tokenizer(examples[sentence1_key], truncation=True) return tokenizer(examples[sentence1_key], examples[sentence2_key], truncation=True) encoded_dataset = dataset.map(preprocess_function, batched=True) metric_name = ( "pearson" if task == "stsb" else "matthews_correlation" if task == "cola" else "accuracy" ) args = TrainingArguments( f"test-glue/{task}_{attention_type}", evaluation_strategy="steps", learning_rate=1e-5, per_device_train_batch_size=batch_size, per_device_eval_batch_size=batch_size, logging_steps=200, num_train_epochs=5, gradient_accumulation_steps=1, warmup_steps=10000, fp16=True, dataloader_num_workers=10, weight_decay=0.1, load_best_model_at_end=True, metric_for_best_model=metric_name, ) def compute_metrics(eval_pred): predictions, labels = eval_pred if task != "stsb": predictions = np.argmax(predictions, axis=1) else: predictions = predictions[:, 0] return metric.compute(predictions=predictions, references=labels) validation_key = ( "validation_mismatched" if task == "mnli-mm" else "validation_matched" if task == "mnli" else "validation" ) trainer = Trainer( model, args, train_dataset=encoded_dataset["train"], eval_dataset=encoded_dataset[validation_key], tokenizer=tokenizer, compute_metrics=compute_metrics, ) trainer.train() ``` Now, I have come back to pre-training. The changes that I think I have done are: not formatting the dataset to torch: ~~`big_dataset.set_format(type='torch', columns=["text", "input_ids", "attention_mask", "token_type_ids"])`~~ so maybe some column is dropped and not freezed in memory and now I have not setted any validation dataset in the trainer. My validation dataset before: ``` book_corpus_eval = load_dataset( "bookcorpus", "plain_text", cache_dir="/home/ad/Desktop/bookcorpus", split="train[98:99%]", ) book_corpus_eval = book_corpus_eval.map(encode, batched=True) book_corpus_eval.set_format( type="torch", columns=["text", "input_ids", "attention_mask", "token_type_ids"] ) **book_corpus_eval = book_corpus_eval.select([i for i in range(1500)])** ``` Maybe _selecting_ or indexing the dataset before feeding it to the trainer, do something strange. My trainer now: ``` big_dataset = load_from_disk("/home/ad/Desktop/35percent_data.arrow/") from transformers import DataCollatorForWholeWordMask data_collator = DataCollatorForWholeWordMask( tokenizer=tokenizer, mlm=True, mlm_probability=0.15) from transformers import Trainer, TrainingArguments training_args = TrainingArguments( output_dir="./big_linear_layerdrop_shared_silu_secondtry", overwrite_output_dir=True, per_device_train_batch_size=60, per_device_eval_batch_size=60, save_steps=500, save_total_limit=10, logging_first_step=True, logging_steps=100, # evaluation_strategy='steps', # eval_steps=250, gradient_accumulation_steps=8, fp16=True, dataloader_num_workers=10, warmup_steps=15000, learning_rate=6e-4, adam_epsilon=1e-6, adam_beta2=0.98, weight_decay=0.01, max_grad_norm=1.0, max_steps=500000, ) trainer = Trainer( model=model, args=training_args, data_collator=data_collator, train_dataset=big_dataset, # eval_dataset=book_corpus_eval, tokenizer=tokenizer) import wandb wandb.login() trainer.train() ``` And surprisingly, the ram now keeps going up and down. The training is up now for 12h without collapse the ram. I don't know what could cause the leakage. :mag: Edit: I didn't see the swap memory, that keeps increasing. So the problem persist.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
Thanks for sharing your results. So you still had the issue for fine-tuning ? And the issue still appears with a bare-bone dataset from an arrow file...
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
27
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. Thanks for sharing your results. So you still had the issue for fine-tuning ? And the issue still appears with a bare-bone dataset from an arrow file...
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/633
Load large text file for LM pre-training resulting in OOM
Yes, on both cases. Fine-tuning a pre-trained model and pre-training from scratch with a local arrow file already pre-processed.
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks.
19
Load large text file for LM pre-training resulting in OOM I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this: ```python from datasets import load_dataset @dataclass class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling): """ Data collator used for language modeling based on DataCollatorForLazyLanguageModeling - collates batches of tensors, honoring their tokenizer's pad_token - preprocesses batches for masked language modeling """ block_size: int = 512 def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]: examples = [example['text'] for example in examples] batch, attention_mask = self._tensorize_batch(examples) if self.mlm: inputs, labels = self.mask_tokens(batch) return {"input_ids": inputs, "labels": labels} else: labels = batch.clone().detach() if self.tokenizer.pad_token_id is not None: labels[labels == self.tokenizer.pad_token_id] = -100 return {"input_ids": batch, "labels": labels} def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]: if self.tokenizer._pad_token is None: raise ValueError( "You are attempting to pad samples but the tokenizer you are using" f" ({self.tokenizer.__class__.__name__}) does not have one." ) tensor_examples = self.tokenizer.batch_encode_plus( [ex for ex in examples if ex], max_length=self.block_size, return_tensors="pt", pad_to_max_length=True, return_attention_mask=True, truncation=True, ) input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"] return input_ids, attention_mask dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train') data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15, block_size=tokenizer.max_len) trainer = Trainer(model=model, args=args, data_collator=data_collator, train_dataset=train_dataset, prediction_loss_only=True, ) trainer.train(model_path=model_path) ``` This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words. During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training. ![image](https://user-images.githubusercontent.com/29704017/93292112-5576b280-f817-11ea-8da2-b2db9bf35665.png) Could you please give me any suggestions on why this happened and how to fix it? Thanks. Yes, on both cases. Fine-tuning a pre-trained model and pre-training from scratch with a local arrow file already pre-processed.
[ -0.6339287758, -0.4775367975, 0.0106936339, 0.2986355424, 0.3600475788, -0.1518250853, 0.5567325354, 0.3738059103, 0.0108824177, 0.0107197072, -0.1295929253, -0.18279998, -0.2669847012, -0.1620898843, -0.0323720984, 0.0232064184, -0.0998212174, 0.1968754083, -0.2772670686, -0.0966667682, 0.0570117086, -0.0776295736, -0.2127604336, -0.0297442414, -0.3879218698, -0.0617135502, 0.3158173263, 0.1221212, -0.1640812606, -0.0958080217, -0.2297018319, 0.119790107, 0.4393487573, 0.4340214729, -0.0001147721, 0.006616035, 0.1890440583, -0.2363325804, -0.1672692001, 0.0192165729, 0.0775553286, -0.3022911847, -0.1064001769, -0.3036170602, -0.0272462256, -0.1061252356, -0.0156821143, -0.2243726701, 0.4987519681, 0.5414044857, 0.1587626338, 0.2508127093, -0.2136606872, 0.0723967925, 0.2544373274, 0.0488998592, 0.1056829095, -0.279514879, 0.4687837362, -0.1923182458, -0.4726888537, 0.1478175521, -0.2247737497, -0.2016822845, -0.0950889289, 0.0382047594, 0.3660890162, 0.0315694809, 0.264187485, 0.3474210203, 0.4272074997, -0.0008117458, -0.2896355689, -0.3209853768, -0.1426238865, -0.0843159407, 0.1892365664, 0.2010776103, 0.0598267578, 0.1184591651, 0.1071273461, -0.1253313273, -0.1519900113, 0.0761609226, -0.2748081684, 0.3397958577, -0.2012512237, -0.0380431116, 0.1555752903, -0.0944791734, 0.1961691827, -0.0997749493, 0.0034041153, 0.2567145824, -0.2454416901, -0.1123952568, -0.0716821104, -0.5194144845, 0.1627841145, -0.2759452164, 0.1981880367, 0.2972389162, -0.0876618102, -0.0676169321, 0.0863934457, 0.4202025831, -0.2524374425, 0.2605278194, 0.2272560149, 0.1640108824, -0.1717063934, -0.0443987809, -0.330511868, -0.196245268, 0.101593703, -0.0773416832, -0.01101714, -0.2546043694, -0.2404216528, 0.0585463457, -0.1407698393, -0.0308451336, 0.2748159766, 0.3899731338, -0.3540614843, 0.4294975996, 0.1651093066, 0.0523290113, -0.4855332971, -0.3365270793, -0.1744022369, 0.1532571465, -0.2032444477, 0.0389758199, 0.1297923326, 0.1396337599, 0.059654139, -0.0428832248, -0.0625894815, -0.4402191341, -0.0094448598, -0.0241032131, 0.0207528826, -0.0425147861, 0.0630237609, -0.0233655367, 0.2347659469, -0.1249950975, -0.0253819991, 0.3477917314, -0.2762122154, -0.2276413292, 0.0509794764, 0.2101763934, -0.0282484628, 0.2091549039, 0.0285064094, 0.076856479, 0.5359787345, 0.0066536209, -0.0471478626, -0.3782060146, 0.0945210904, 0.09201736, 0.1619914323, 0.1766303331, -0.0425881632, -0.0726021677, 0.0063892393, 0.1035868898, 0.255040884, 0.3907330334, -0.2264700383, 0.2906735837, 0.0070044314, -0.0566554591, 0.531992197, -0.2620989084, -0.448443979, 0.2338527441, -0.3511554897, 0.1081818491, 0.2206699997, 0.1759026051, 0.1138893515, -0.1089851037, 0.269015044, 0.3656848669, 0.0705157742, 0.1209139377, -0.2366241515, -0.0922286212, -0.1715157032, 0.484202981, 0.3627240956, -0.0255861767, -0.0730891153, 0.3563797474, 0.1833981574, -0.1992233247, 0.1312806904, 0.3693415225, -0.1744248569, -0.1261585057, 0.0944814086, 0.0655978322, -0.3000326455, -0.0709873065, -0.0908445045, 0.0828674436, -0.113605693, -0.0894262865, 0.2825580835, 0.0228702798, -0.0766652972, 0.1131797433, 0.0379410386, -0.1318217963, 0.0248665065, -0.0704168901, 0.1261966228, 0.0154216662, -0.0932068974, 0.0873603746, -0.2184159905, -0.1239405051, 0.0018027833, -0.1370612979, 0.0769502148, 0.1752731353, -0.0511877313, 0.0384013392, -0.1730398387, 0.1069575101, -0.1529778093, -0.298707068, -0.5071571469, 0.4358932972, 0.1864788085, -0.3381094635, 0.3402596712, 0.1040275842, -0.0295993686, -0.1062710881, -0.1198952049, 0.5749332309, 0.2730709314, 0.0196178816, 0.2990929186, -0.2454111725, 0.2542811036, -0.2662390769, -0.1036156192, -0.0977649167, 0.4209234416, 0.0310555417, 0.2350631654, 0.148280859, -0.0869455338, -0.2320595682, 0.4703812003, -0.1788096428, -0.0138721522, 0.2665260434, -0.42472139, -0.0115633914, -0.3480208814, -0.2494778484, 0.0067338794, 0.1732287854, -0.0944128707, -0.0554352067, 0.008537855, -0.2627931237, 0.007836163, 0.1532372683, -0.071852088, 0.3198344707, 0.1165148765, 0.1005952582, -0.1228920668, -0.1794071943, 0.1028475463, 0.1782901436, -0.2751910388, 0.1844427735, -0.0228228215, -0.0134466691, -0.2862634957, 0.1904246807, -0.1268012673, 0.0388153642, -0.0647432804, 0.2586891055, -0.0779030025, 0.1019123122, 0.3001610041, 0.3549231291, 0.4629623294, -0.078094922, 0.3263479173, -0.0826637447, -0.179695949, 0.0329435393, 0.3345076442, -0.3179928362, -0.0248904116, 0.0053772237, 0.0511769243, -0.0989300385, -0.1660347283, 0.0946891159, 0.1968245059, -0.1661895066, -0.2573058605, -0.0721762925, 0.1776910722, -0.0424320959, 0.1197286695, -0.2324416637, 0.0084072342, 0.1450571865, -0.0062899678, -0.1843239069, 0.0404453538, -0.1199218407, -0.0470516644, -0.4116414487, -0.0535182469, 0.1070508584, 0.1367316544, 0.3593675792, 0.1067890301, 0.1944517642, 0.2884452343, 0.1585921198, 0.0063675116, -0.0885990858, 0.514171958, -0.0175728817, -0.2971981764, -0.2908624411, -0.2397542596, 0.0251129922, 0.3155243397, -0.6842605472, 0.2337828726, -0.1138518378, -0.0940266177, -0.3955195546, 0.0007259165, 0.2522046864, -0.0761485249, 0.0163397267, 0.0954743102, 0.2302767783, 0.1546789706, -0.0387875624, 0.3857944012, -0.4130838215, 0.3594084978, -0.1354580224, 0.4855528176, -0.1221181452, -0.2300206274, 0.0988748446, 0.150448218, -0.0171155203, -0.0218025893, -0.013968504, -0.2593792975, -0.0582376271, 0.0227312557, 0.5197219849, 0.0168901123, -0.1655895114, -0.0158989225, 0.0681641772, 0.2563199401, -0.2606987357, 0.4905276895, -0.1907786578, 0.0184166096, -0.1996744573, 0.018745685, -0.2049808055, -0.215085566, -0.1641349345, 0.0934441686, -0.0303828474, -0.2240439802, -0.2116938084, 0.1031402275, -0.3681345582, -0.0437650047, 0.1179903299, 0.2293323725, 0.180770576, -0.1961434186, -0.086288549, -0.2018707991, 0.3574142754, 0.1934526861, 0.1124653816, 0.1632592976, -0.0568786226, -0.2155373245, -0.1774518341, -0.2904544771, 0.1419077218, 0.6505103707, 0.6102461219, -0.2162736505, -0.1585991681, 0.0791449249, 0.0026030652, -0.165273279, -0.5487569571, -0.1285093725, -0.1654993445, -0.4410513937, 0.0046062781, 0.3584984243, 0.3558540642, -0.22644566, -0.0318753272, 0.1387299597, -0.0007014232, 0.3717510402, -0.1297641248, 0.015053574, -0.0664107651, 0.2258286476, -0.1074175015, 0.3673554361, 0.2488898337, 0.3563637137, 0.1917258948, -0.3175571263, 0.0706881434, -0.0298887268, 0.2314308435, 0.1151607335, 0.110228315, 0.3546279967, 0.128971085, 0.3322557211, -0.1909665465, 0.6737232804, -0.0073443507, 0.2068270594, -0.8374908566, -0.2673701942, 0.3314560056, -0.0263577066, 0.1994025707, 0.2157178372, -0.4038516879, -0.3216699064, 0.3766613007, 0.0990833342, 0.7675246596, -0.2972694337, 0.3962582052, -0.1552994251, 0.6611962914, 0.1280310601, -0.3813101351, 0.1585617661, -0.3987911642, -0.2663660347, 0.2130052298, -0.0923115239, 0.0365401395, 0.1605038643, -0.2905769646, -0.0298116673, 0.0862521157, 0.2249334008, 0.130669862, 0.5134937763, 0.1209266186, -0.600698173, -0.0828131065, 0.0265691411, -0.0234004669, -0.1049020886, -0.049279213, 0.0799463987, -0.0313266367, -0.2085639089, -0.0284665171, 0.205257833, -0.2474460602, 0.0866158083, 0.0637525693, -0.0720531121, 0.5367996097, 0.1062303782, -0.0013606648, 0.4988961518, -0.0392867327, 0.1321583688, -0.2274818718, -0.1652867049, 0.2007086128, -0.0658490956, 0.4217028618, 0.0883790255, -0.0005877246, 0.1141034588, 0.0632385314, -0.0466908105, 0.0947638825, -0.3643093109, 0.1054971069, -0.4112312198, -0.2154277414, -0.0884305388, -0.3007825911, -0.1009221226, 0.1231094971, 0.1373569965, -0.4644461274, 0.1151453257, 0.2652112246, -0.3750101328, 0.0119967815, 0.3838247657, 0.1710590869, -0.105138883, 0.4998430014, 0.4575878084, -0.0533618517, -0.2644974291, -0.1096290797, 0.2944484651, -0.2731434703, 0.0849161148, -0.2455590516, -0.3016010821, 0.2093509287, 0.0808757395, 0.1000995934, -0.0149995526, -0.0632621124, -0.2510293424, -0.6380496621, -0.1814442873, -0.0027230312, -0.0035483714, 0.146083653, 0.2738986313, -0.310046941, 0.5892781019, -0.2788559198, -0.052941788, -0.2076085359, 0.2782230675, -0.0555623733, -0.3855460584, 0.2115359306, 0.203352496, 0.100104101, 0.0805967897, 0.0059090997, -0.2213537991, -0.1435203254, 0.1127154306, 0.2364701182, -0.4196631014, -0.0159935597, -0.3129968643, -0.0924900621, -0.2700215876, 0.0660678744, 0.0170286167, 0.0139455562, -0.2261789143, 0.0093941661, 0.0475258939, -0.2552625537, 0.0420603566, -0.2545849979, 0.1250909269, 0.2465713024, 0.1331034005, 0.1178304181, 0.0006368674, -0.39310202, 0.1796458364, 0.6661382914, -0.0175324008, 0.4190824628, -0.4357323945, -0.0715065226, 0.247659415, 0.0498033017, 0.048066061, -0.3416771889, -0.0107187238, 0.2935880125, 0.2268189788, 0.0152087733, -0.0147334104, 0.2263551056, -0.4112984836, 0.1301488876, 0.3453428149, -0.1119267717, -0.0674755946, 0.1559655219, 0.0913229808, 0.5066780448, 0.1149651706, 0.0057113338, 0.2489493787, -0.001220117, 0.1548575163, 0.4856929183, 0.2611193657, 0.2386805862, 0.3016281426, -0.0326662362, -0.0406999178, -0.2312836349, 0.2294138521, -0.4356159866, -0.4151661694, -0.2674565315, 0.5044153929, -0.0193238575, 0.1242091432, -0.3350304961, -0.0662411302, -0.0406534113, 0.2541331649, -0.1192155406, 0.2744085193, -0.4530943632, -0.1705992669, -0.0894244462, -0.1239619032, 0.0115339896, 0.1896334738, -0.0558586083, 0.2722766995, -0.5796655416, 0.2293860167, 0.0521360412, 0.145150125, -0.1346787363, 0.1227788106, 0.1055011004, -0.5078572035, 0.3433355689, 0.2378558517, 0.2918593287, 0.1154051423, -0.2219064534, 0.3443706036, 0.4366976619, -0.1908069104, -0.0406121425, -0.1209840924, -0.0356198065, -0.1499130428, 0.1974351406, 0.3490366042, 0.1878992021, 0.2596161366, 0.0557277352, -0.2659660578, 0.2785173655, 0.0650137886, -0.3240588009, 0.1786665469, -0.1329391301, 0.4019321501, -0.3285807371, -0.4429641962, 0.0098670311, -0.3941244185, 0.2155873924, 0.6670196652, -0.2954227626, 0.2878553569, -0.0254884064, 0.0485502705, 0.0018408649, 0.4760500491, 0.4697352946, 0.2841595113, -0.3783714771, -0.0256677344, -0.3288836777, 0.2765586078, -0.2024303377, 0.0669974536, 0.0222479869, 0.1707944721, 0.1645778716, -0.0033022426, -0.0796227604, -0.0136220623, 0.2188031375, -0.1950692683, -0.1675593108, -0.1280472726, 0.002094669, 0.3573178947, -0.025900675, -0.297549814, 0.1588655859, 0.1150630713, 0.0991569832, -0.3214531243, 0.3626994789, -0.198463425, -0.0203630701, 0.0691281036, -0.1504710913, 0.379209578, -0.2204387635, -0.0330467634, -0.0818275213, 0.1281417012, -0.1670769602, -0.2209999114, 0.3402221501, 0.3884243667, -0.1076364294, 0.1082137674, -0.2551926076, -0.086462304, 0.040304441, -0.3696906269, -0.3087161481, -0.0074875448, -0.0002531049, 0.0085247457, 0.1030982137, 0.2458303422, 0.1053374857, -0.0278405156, -0.2292287946, -0.1855803728, 0.2094751149, -0.2946498394, -0.3130411506, -0.0353800692, 0.0556243658, -0.1636291295, 0.2511018217, -0.4624069035, 0.1457486451, 0.2297440022, -0.0255144555, -0.4540735781, 0.2232971638, 0.2540614307, 0.016472023, -0.2076970041, 0.0534572378, 0.152623415, -0.1369921863, -0.2016398907, -0.1757195294 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
Basically ~600MB txt files(UTF-8) * 59. contents like ```안녕하세요, 이것은 예제로 한번 말해보는 텍스트입니다. 그냥 이렇다고요.<|endoftext|>\n``` Also, it gets stuck for a loooong time at ```Testing the mapped function outputs```, for more than 12 hours(currently ongoing)
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
36
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. Basically ~600MB txt files(UTF-8) * 59. contents like ```안녕하세요, 이것은 예제로 한번 말해보는 텍스트입니다. 그냥 이렇다고요.<|endoftext|>\n``` Also, it gets stuck for a loooong time at ```Testing the mapped function outputs```, for more than 12 hours(currently ongoing)
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
It gets stuck while doing `.map()` ? Are you using multiprocessing ? If you could provide a code snippet it could be very useful
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
24
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. It gets stuck while doing `.map()` ? Are you using multiprocessing ? If you could provide a code snippet it could be very useful
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
From transformers/examples/language-modeling/run-language-modeling.py : ``` def get_dataset( args: DataTrainingArguments, tokenizer: PreTrainedTokenizer, evaluate: bool = False, cache_dir: Optional[str] = None, ): file_path = args.eval_data_file if evaluate else args.train_data_file if True: dataset = load_dataset("text", data_files=glob.glob(file_path), split='train', use_threads=True, ignore_verifications=True, save_infos=True, block_size=104857600) dataset = dataset.map(lambda ex: tokenizer(ex["text"], add_special_tokens=True, truncation=True, max_length=args.block_size), batched=True) dataset.set_format(type='torch', columns=['input_ids']) return dataset if args.line_by_line: return LineByLineTextDataset(tokenizer=tokenizer, file_path=file_path, block_size=args.block_size) else: return TextDataset( tokenizer=tokenizer, file_path=file_path, block_size=args.block_size, overwrite_cache=args.overwrite_cache, cache_dir=cache_dir, ) ``` No, I'm not using multiprocessing.
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
71
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. From transformers/examples/language-modeling/run-language-modeling.py : ``` def get_dataset( args: DataTrainingArguments, tokenizer: PreTrainedTokenizer, evaluate: bool = False, cache_dir: Optional[str] = None, ): file_path = args.eval_data_file if evaluate else args.train_data_file if True: dataset = load_dataset("text", data_files=glob.glob(file_path), split='train', use_threads=True, ignore_verifications=True, save_infos=True, block_size=104857600) dataset = dataset.map(lambda ex: tokenizer(ex["text"], add_special_tokens=True, truncation=True, max_length=args.block_size), batched=True) dataset.set_format(type='torch', columns=['input_ids']) return dataset if args.line_by_line: return LineByLineTextDataset(tokenizer=tokenizer, file_path=file_path, block_size=args.block_size) else: return TextDataset( tokenizer=tokenizer, file_path=file_path, block_size=args.block_size, overwrite_cache=args.overwrite_cache, cache_dir=cache_dir, ) ``` No, I'm not using multiprocessing.
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
I am not able to reproduce on my side :/ Could you send the version of `datasets` and `pyarrow` you're using ? Could you try to update the lib and try again ? Or do you think you could try to reproduce it on google colab ?
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
47
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. I am not able to reproduce on my side :/ Could you send the version of `datasets` and `pyarrow` you're using ? Could you try to update the lib and try again ? Or do you think you could try to reproduce it on google colab ?
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
Huh, weird. It's fixed on my side too. But now ```Caching processed dataset``` is taking forever - how can I disable it? Any flags?
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
24
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. Huh, weird. It's fixed on my side too. But now ```Caching processed dataset``` is taking forever - how can I disable it? Any flags?
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
Right after `Caching processed dataset`, your function is applied to the dataset and there's a progress bar that shows how much time is left. How much time does it take for you ? Also caching isn't supposed to slow down your processing. But if you still want to disable it you can do `.map(..., load_from_cache_file=False)`
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
55
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. Right after `Caching processed dataset`, your function is applied to the dataset and there's a progress bar that shows how much time is left. How much time does it take for you ? Also caching isn't supposed to slow down your processing. But if you still want to disable it you can do `.map(..., load_from_cache_file=False)`
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
Ah, it’s much faster now(Takes around 15~20min). BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :(
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
29
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. Ah, it’s much faster now(Takes around 15~20min). BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :(
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
> Ah, it’s much faster now(Takes around 15~20min). Glad to see that it's faster now. What did you change exactly ? > BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :( Oh I didn't know about that. Feel free to open an issue to mention that. I guess what you can do for now is set the dataset format to numpy instead of tensorflow, and use a wrapper of the dataset that converts the numpy arrays to tf tensors.
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
92
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. > Ah, it’s much faster now(Takes around 15~20min). Glad to see that it's faster now. What did you change exactly ? > BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :( Oh I didn't know about that. Feel free to open an issue to mention that. I guess what you can do for now is set the dataset format to numpy instead of tensorflow, and use a wrapper of the dataset that converts the numpy arrays to tf tensors.
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/630
Text dataset not working with large files
>>> Glad to see that it's faster now. What did you change exactly ? I don't know, it just worked...? Sorry I couldn't be more helpful. Setting with numpy array is a great idea! Thanks.
``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry.
35
Text dataset not working with large files ``` Traceback (most recent call last): File "examples/language-modeling/run_language_modeling.py", line 333, in <module> main() File "examples/language-modeling/run_language_modeling.py", line 262, in main get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset dataset = load_dataset("text", data_files=file_path, split='train+test') File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__ for obj in iterable: File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status ``` **pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)** It gives the same message for both 200MB, 10GB .tx files but not for 700MB file. Can't upload due to size & copyright problem. sorry. >>> Glad to see that it's faster now. What did you change exactly ? I don't know, it just worked...? Sorry I couldn't be more helpful. Setting with numpy array is a great idea! Thanks.
[ -0.4925668538, -0.2310243845, -0.119864285, 0.2836015522, 0.4663561881, -0.0735015199, 0.3053680658, 0.5961021781, -0.1138257012, 0.0461648479, -0.0624196492, -0.030405255, -0.1033420116, 0.3101792932, -0.106213443, -0.0389503799, -0.2278844565, 0.1130641326, -0.0946917832, 0.0499165095, -0.1125509888, 0.1111003458, -0.1209788918, -0.0956026316, -0.4804551005, -0.0829954743, 0.1185313314, 0.2535655797, -0.2920110226, -0.3053142428, -0.1657067984, 0.0965852216, 0.1122044101, 0.6015898585, -0.0001037621, 0.1294622719, 0.2131119519, -0.1573346853, -0.2265826762, -0.0314552858, 0.1559487283, -0.4493689239, -0.1823890507, -0.2179644406, 0.0261510238, -0.0627441928, -0.1082876623, -0.1175598279, 0.2653357685, 0.5598000288, 0.3412033916, 0.1707590669, 0.1321691275, -0.1129613295, 0.2507538795, -0.0872496516, -0.088744238, 0.0848499835, 0.3108180165, 0.0265774168, -0.2564011514, 0.3199442327, 0.0101716351, 0.0377004407, 0.0003138823, -0.0240627341, -0.0827937573, -0.294005096, 0.3711950779, 0.232146278, 0.5224131942, -0.3169362545, -0.1641274542, -0.3288430274, -0.1824412495, -0.3512558043, 0.2266325057, 0.1845537871, -0.1113314107, 0.1161270663, -0.1436177045, -0.1014852896, -0.206397146, -0.0293163322, -0.2615340948, 0.1022740975, -0.2105868906, -0.1004621163, 0.2575801909, -0.2702475786, 0.0108294701, -0.10562177, -0.130783543, -0.00680548, -0.2472132742, -0.0840228349, 0.2468505949, -0.1990784109, 0.2889423072, -0.0489982143, -0.0504208319, 0.2247609049, -0.0796670467, -0.0302132815, 0.0054929825, 0.3368761837, 0.0041133151, 0.0638571605, 0.4085854888, 0.2356286049, -0.3793580532, -0.232061252, -0.1496263593, -0.5145172477, -0.0293560531, -0.1177167818, 0.0168721024, -0.0452365726, -0.1210254207, 0.1521079987, 0.1642946154, 0.1547951251, 0.1059664786, 0.4816169739, 0.1049144566, 0.2937652469, -0.1649463773, 0.1770394593, -0.1443265229, -0.1722712815, -0.2492275536, -0.0456117205, -0.0579166599, -0.0926888883, 0.2676636279, 0.1338511109, 0.2967103124, -0.1395808905, 0.1908532977, -0.1090159938, 0.1168144196, -0.502969265, 0.1476962417, 0.1410787106, -0.0354772918, 0.1686934531, 0.2287828028, -0.1788700372, -0.1023909971, 0.0502353087, -0.1035606787, -0.2971289158, 0.1772405952, 0.3213210404, 0.1347747445, -0.0030028867, -0.0189048387, 0.2770773172, 0.3757718503, -0.2176394314, 0.0281009413, -0.1773215979, -0.2569281459, -0.125802964, 0.2650005221, 0.4393817186, -0.425060302, 0.2090140432, 0.0690165386, 0.1223087087, 0.0890248343, 0.3739469051, -0.0650725961, 0.3143596053, -0.114571318, 0.2009440362, 0.3094800711, -0.285585463, -0.5090753436, 0.5406071544, -0.1859301925, -0.1181869358, 0.0992575884, -0.0444512144, 0.1034918725, 0.1358729303, 0.3047404885, 0.2793404162, 0.0113196326, 0.2667298615, -0.2604503334, -0.0832504407, -0.0501145199, 0.1559396982, 0.3121377826, -0.2080697417, 0.1951687634, -0.0172313973, 0.194376424, -0.0444459878, 0.2128832638, 0.5059320331, 0.1271579862, -0.0078409147, -0.0123688476, -0.2239850909, 0.0316569768, 0.1751382053, 0.1210088804, 0.0843074173, -0.2666848898, -0.0822332203, -0.3092454672, -0.1341454983, -0.2703467309, -0.1933863461, 0.2836053371, 0.0813239068, -0.0114757884, 0.2551391721, -0.0167011693, 0.0253124628, -0.1602133214, -0.0655837953, -0.0120965587, -0.0018738963, -0.0910837874, -0.2782085836, 0.1229490936, 0.1102731526, -0.0411426947, -0.0616681352, -0.1109169051, 0.3928830028, -0.002020211, -0.0810619518, -0.036069598, -0.0300615337, 0.102001749, -0.0952062607, 0.0719459429, 0.000755044, 0.1388050169, -0.1053132713, -0.1801616699, 0.300614506, -0.1398150176, 0.2031629831, 0.3438570201, -0.20907408, 0.2556622028, -0.0663510934, 0.2276657969, -0.1381174624, 0.2406677604, 0.0831320062, 0.1363213062, -0.0013493086, -0.2719838917, -0.0127428947, 0.6895838976, 0.1710655391, 0.092892617, 0.1747952253, -0.2453398257, -0.0179572739, -0.2034238726, 0.1299689263, 0.3976373971, 0.2744439542, 0.2679816186, 0.0357758403, 0.1870049387, -0.3740030825, 0.1397107542, 0.0032487821, 0.0111852214, 0.5398926139, 0.2758918107, -0.1295804232, -0.4534210861, -0.1563687325, 0.1057757661, 0.3134024143, -0.0895872563, 0.0198824871, -0.21556288, -0.292028904, -0.2959758937, 0.21032767, -0.262732327, -0.2253177762, 0.0694884285, 0.0018546021, -0.009653558, 0.0968661904, 0.0594206899, 0.1454252452, 0.399749428, -0.1988247484, -0.0615104027, -0.2715905905, -0.173049584, 0.1567441523, 0.2421878427, -0.0123149389, 0.1066427603, -0.1534678042, -0.10159605, 0.0038626578, -0.2853767872, 0.0006908637, -0.0291902628, 0.1006611064, -0.0571642444, 0.2626275122, 0.166274935, 0.0769827887, 0.3128010333, -0.1297488511, -0.0807749555, 0.2233642638, 0.0906754136, -0.0652652532, -0.1705734283, -0.4048939347, -0.1530369222, -0.6100059748, 0.3575114012, 0.0955665559, 0.0380037539, 0.4022581279, 0.3181683123, 0.2154984921, -0.0212015044, 0.2124928683, 0.1002641544, -0.1950190365, 0.2925721407, -0.2248307765, -0.3832400739, -0.0998249725, 0.1606034487, 0.1626161039, 0.0072618267, -0.5234436989, 0.0302406121, -0.4368820786, 0.162367627, -0.0637961924, 0.1686918586, 0.0814081877, -0.0684887916, -0.2522608638, -0.0842749402, 0.0830215365, 0.0467453524, -0.0724340752, 0.0489531569, -0.1854186952, 0.4121850133, 0.2402957231, 0.462680608, 0.1637824923, 0.0814505368, 0.3938986659, -0.121706821, 0.4271224141, -0.3532855511, -0.326511234, 0.1239756569, -0.091245383, -0.0329020768, 0.2716789544, 0.0862798765, 0.2699361145, -0.0800967515, -0.2192069143, 0.0848961025, -0.27935341, 0.2020106018, -0.1586166471, 0.1581824273, -0.1357392222, -0.0241032317, -0.076738663, -0.1311156899, -0.0338695049, 0.1800868362, -0.240611583, -0.0250576288, -0.3433842957, 0.0648815855, -0.4402945042, 0.1162606254, -0.0008667649, 0.3317790627, -0.1660777628, -0.1548695415, -0.1084448621, -0.1574719697, 0.5587425232, -0.0700287074, 0.0500068031, 0.0628434643, -0.0919485316, -0.3191089332, 0.1609368324, -0.2735012174, 0.1588299274, 0.3647181988, 0.5645071268, -0.3012344241, -0.0509776287, -0.0399974771, 0.3442742527, 0.0167829804, -0.0334482417, -0.2761997283, -0.1711503565, -0.4797544181, 0.1388341188, 0.2979474664, 0.2846295536, -0.2693780363, 0.0718104541, 0.0067698304, -0.2416712046, 0.2142868936, 0.0040952354, 0.1445523351, -0.096557416, 0.2255923003, -0.1108150706, 0.1980493516, 0.1853600442, 0.5712106824, -0.0331978463, -0.1837666184, -0.1003365219, -0.1977577955, 0.3502214849, 0.3210825622, -0.1226087734, 0.2475551814, -0.0468917862, 0.2047811002, 0.0162529647, 0.3714407384, 0.2987756729, -0.0353546441, -0.2595376968, -0.2792066634, 0.1115556657, -0.0845498368, 0.1867006868, 0.1408400238, -0.3193203807, -0.2557849288, 0.0803831741, -0.3155543804, 0.5819584727, 0.0936631486, 0.3404356837, -0.0566668883, 0.1961905211, 0.0629074723, -0.5295389295, 0.2434755117, -0.3393684328, -0.2687771618, 0.084047243, -0.0019825432, 0.0826100707, 0.1538454443, -0.2705696821, 0.0997353271, 0.1199410781, 0.1092549935, -0.2874218822, 0.3836097717, -0.4040073454, -0.1202328503, -0.317088753, 0.1808963716, 0.0384626761, -0.1584915966, -0.0123262219, -0.1195178106, 0.0203618612, -0.2523368001, -0.1452477872, -0.0493157469, -0.419803828, 0.1822545677, 0.0395059735, -0.3351990283, 0.2435077578, 0.177771017, 0.071756281, 0.4507848024, -0.2375142127, 0.178659156, 0.011980175, -0.0270823389, 0.156638518, -0.0020524799, 0.3159707189, -0.0124908956, -0.2267413884, 0.0910505727, -0.0267280955, 0.1002252251, -0.0211734343, 0.005435281, -0.041703444, -0.3602178991, -0.2473489493, -0.1221573055, -0.2448609322, -0.3007042408, 0.2255004346, -0.0533377938, -0.0544014908, 0.168014273, 0.070989795, -0.3310468197, -0.1633547843, 0.3258529305, -0.1954341978, 0.1789703667, 0.5283616185, 0.3944671154, -0.2252093703, -0.3289532363, 0.3111715317, -0.0288907457, -0.3540941179, 0.2759122252, 0.0270211529, -0.0696797594, 0.1265560091, 0.2427481413, -0.14057675, -0.3056273162, -0.1277888268, -0.2381086797, -0.4304109216, 0.0736414343, -0.0146859558, 0.1428981423, -0.0120185232, 0.2134839296, 0.1132786945, 0.2139744908, -0.4020755291, 0.1423479319, -0.177186355, 0.0996008441, 0.0931537449, -0.135548383, 0.1392202377, 0.0518153161, 0.1112696603, 0.254656285, -0.0731491745, -0.3498376906, -0.1104322001, 0.0802938864, 0.0429648496, -0.1213976294, -0.0186525788, -0.3757627606, -0.2571218908, -0.2619500756, 0.205538705, -0.0595569871, -0.1060271859, 0.1788905561, -0.1484439969, -0.0594711266, 0.1162797138, -0.0307374988, -0.2113559395, 0.113502726, 0.1723379046, 0.0354113355, 0.0073985318, 0.0013164716, -0.3159469068, 0.0826844797, 0.1583470404, -0.0741559714, 0.3244624734, -0.3757270575, -0.0566548333, 0.1769371629, 0.3609239459, 0.4115838706, -0.2069199532, -0.0283431485, 0.2429047227, 0.2981538773, -0.2532996237, -0.1001687497, 0.0949342623, -0.2748053372, 0.3003484905, 0.1226505339, 0.1055467874, -0.0864748508, -0.1073914394, 0.223381266, 0.1748342216, -0.0378284231, -0.1495874077, 0.3407846391, 0.1178209856, -0.0499306023, 0.3016182184, 0.1821385473, 0.301396817, 0.7971206307, 0.0785117224, 0.2538467944, -0.2110732049, -0.0938015878, -0.1365758479, -0.447460115, 0.022836864, -0.0801566988, -0.0352988057, -0.1246767193, -0.2056945264, 0.2049507946, -0.0154314591, 0.2201547623, -0.1490972191, 0.04368544, -0.2486525476, -0.1612090468, 0.0436244495, -0.3107736409, -0.0689436048, 0.106192261, -0.1068828925, 0.3263958097, 0.12429405, 0.0623804554, 0.1022237316, -0.429412812, 0.2035556585, -0.0626898706, 0.0876703411, -0.3625389338, 0.283985883, 0.261313051, 0.1896340102, 0.15717794, 0.1909475625, 0.5729640722, 0.3944716752, -0.1363314986, -0.0809938386, -0.275599122, -0.1103979871, -0.4154100716, 0.2859198153, 0.1979577839, 0.3553817868, 0.464335978, 0.2075482458, -0.2680901289, -0.0660789758, 0.1920686066, -0.2637650967, -0.2234545499, 0.1047905311, 0.0679991916, -0.2863514125, -0.3225554228, -0.0183769092, -0.4338230789, -0.0045644953, 0.5934920907, -0.1135882735, 0.3091259897, -0.3395169079, 0.1448054165, 0.0052001546, 0.6057998538, 0.29538849, -0.0178114623, -0.2954345047, -0.0195162036, -0.6181397438, 0.1262810826, -0.1511757374, 0.0123336231, -0.0116538871, 0.1425364465, 0.1738922298, -0.0330510437, -0.0051009473, 0.0362967476, -0.1498091519, -0.1097008884, -0.3313086331, -0.2676606178, -0.2250267863, 0.1569496244, -0.0014628816, -0.3760663271, 0.1550828964, -0.0955089778, 0.2300336361, -0.1793870479, 0.0802162364, -0.0206276346, -0.0355977789, 0.1578442454, 0.0340668447, 0.3657598197, -0.2838611007, 0.0340453945, -0.1346199512, -0.0631753728, -0.1700667143, 0.1941981763, 0.2527386844, 0.2654085457, -0.0962214991, -0.1707083136, -0.1380878985, 0.1567031592, 0.0587184057, 0.0371343903, 0.1429636329, -0.0507428162, 0.1262889504, 0.0587170757, 0.1863673776, 0.4029748738, -0.1113760918, -0.0343028456, -0.3506343961, -0.5414937735, 0.2185379565, -0.1180817485, -0.515847981, 0.0103079276, 0.1300400645, 0.18110843, 0.0267861038, -0.5836284161, 0.3067767024, 0.3096932173, 0.1339993924, -0.3529006243, 0.2580339313, -0.0505170599, 0.0583430119, 0.0119163813, 0.1201326996, 0.0242643338, -0.270224452, -0.2056575716, -0.0322017334 ]
https://github.com/huggingface/datasets/issues/625
dtype of tensors should be preserved
Indeed we convert tensors to list to be able to write in arrow format. Because of this conversion we lose the dtype information. We should add the dtype detection when we do type inference. However it would require a bit of refactoring since currently the conversion happens before the type inference.. And then for your information, when reading from arrow format we have to cast from arrow to numpy (which is fast since pyarrow has a numpy integration), and then to torch. However there's one thing that can help you: we make sure that the dtypes correspond to what is defined in `features`. Therefore what you can do is provide `features` in `.map(preprocess, feature=...)` to specify the output types. For example in your case: ```python from datasets import Features, Value, Sequence features = Features({ "input_ids": Sequence(Value("int32")), "sembedding": Sequence(Value("float32")) }) preprocessed_dataset = dataset.map(preprocess, features=features) preprocessed_dataset.set_format("torch", columns=["input_ids", "sembedding"]) print(preprocessed_dataset[0]["sembedding"].dtype) # "torch.float32" ``` Let me know if it helps
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
156
dtype of tensors should be preserved After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. Indeed we convert tensors to list to be able to write in arrow format. Because of this conversion we lose the dtype information. We should add the dtype detection when we do type inference. However it would require a bit of refactoring since currently the conversion happens before the type inference.. And then for your information, when reading from arrow format we have to cast from arrow to numpy (which is fast since pyarrow has a numpy integration), and then to torch. However there's one thing that can help you: we make sure that the dtypes correspond to what is defined in `features`. Therefore what you can do is provide `features` in `.map(preprocess, feature=...)` to specify the output types. For example in your case: ```python from datasets import Features, Value, Sequence features = Features({ "input_ids": Sequence(Value("int32")), "sembedding": Sequence(Value("float32")) }) preprocessed_dataset = dataset.map(preprocess, features=features) preprocessed_dataset.set_format("torch", columns=["input_ids", "sembedding"]) print(preprocessed_dataset[0]["sembedding"].dtype) # "torch.float32" ``` Let me know if it helps
[ -0.1134336665, -0.221115008, -0.0097108139, 0.2073050439, 0.5532283783, 0.1730132401, 0.5313699245, 0.1225807741, 0.1504824311, -0.0665397719, -0.0843991637, 0.2457148433, -0.117551893, -0.1751451641, 0.1026155949, -0.2025275528, 0.2282531559, -0.0652568489, -0.1441735029, -0.2050459683, -0.2274059653, -0.0888314694, -0.0027087252, -0.2082730085, -0.1601843834, -0.1640593857, 0.240316391, -0.1392812878, -0.185163781, -0.0010071729, 0.1801279187, -0.1652226001, 0.4167293906, 0.5717648268, -0.0001163156, 0.2217251658, -0.0266849883, -0.0754260495, -0.1886362731, -0.0001531355, 0.0046073291, -0.1931505948, -0.0723767504, -0.1798607111, -0.1541207731, -0.1833255589, -0.0845146552, -0.7935449481, 0.2889487147, 0.4108265638, 0.1519325376, 0.2570817769, 0.0712020621, 0.1525933743, -0.1351299435, 0.2725166082, -0.1030128226, 0.2802624106, -0.0208768621, 0.3604670167, -0.0614816993, 0.4459063411, -0.3614789546, -0.0750736743, 0.0291569643, 0.1127889976, 0.0541250817, -0.4639117718, -0.0662837625, 0.1654173583, 0.1973417401, -0.2320811003, -0.2843653858, -0.1672888547, -0.0933568701, -0.367162168, 0.0662379116, -0.0845818296, 0.1454868317, 0.1031548604, -0.0847082958, -0.1715695858, -0.0345696211, 0.1320960969, -0.4753401279, 0.2185825855, -0.0089361332, 0.1474191248, -0.1035435423, -0.0327193514, 0.074318178, -0.115951173, 0.2209848762, -0.0332038701, -0.1700054407, -0.223601684, 0.1068102717, -0.4505301416, -0.1278469265, -0.48186782, 0.2282643914, 0.1562224776, -0.2183921039, -0.0274901204, 0.210150376, 0.3317387402, -0.297642678, 0.3678761423, 0.2994465232, -0.0447377264, 0.2111327052, 0.0985191241, 0.1282293648, 0.046433866, -0.0115374792, 0.1037945673, 0.5391175747, -0.1061271951, -0.3156948388, 0.2423451692, -0.4640919268, 0.0854393989, 0.0290507134, 0.0762219205, -0.1580675989, 0.4469194114, 0.1909369379, 0.0856406093, -0.1537801474, -0.0482110791, -0.1408703178, -0.246330142, 0.0493122563, -0.175722912, 0.047348123, 0.1110769287, -0.0556812771, 0.290984422, 0.1304949522, 0.1616607606, -0.0623955205, -0.1468251497, 0.5156328082, 0.2943933308, -0.3300796449, 0.1609630883, 0.2148126066, -0.3500459194, -0.1941232532, 0.34138304, -0.2835558653, 0.0002673641, -0.2552974522, 0.0896735564, -0.0626334995, -0.1942969412, 0.0383377522, 0.5168799162, 0.5945782661, 0.0745409727, 0.3335528076, -0.5255038142, -0.2444201857, -0.2121092975, 0.0651088804, -0.0023092092, -0.4651452303, -0.0084926235, 0.2366490513, 0.1842956841, 0.3561902046, 0.4137145579, 0.0704918802, 0.1077741235, 0.0749111027, -0.0053550522, 0.4220858514, 0.1117162332, -0.2204667777, -0.0649490207, -0.05865575, 0.3635669947, -0.080704838, 0.0079565262, 0.3194954395, -0.2035728544, 0.2078324556, 0.0254101828, -0.2768172026, 0.0815220773, -0.2061397731, 0.0387926735, 0.4647623003, -0.0825524554, -0.0355013385, -0.0381801128, -0.3315751553, 0.3626122177, 0.2424905449, -0.1368881017, 0.0368464403, 0.0449778922, 0.0548132509, -0.0328166969, 0.0832959265, -0.0828898773, -0.5234783888, -0.0470568463, 0.0362096876, 0.2670902014, -0.0503190905, -0.1362541914, 0.2245898396, 0.0831877962, -0.0103790052, 0.0391421653, 0.0681505799, -0.171751827, -0.4256083965, 0.0723532289, -0.096664995, -0.2199120224, -0.0393040106, 0.1064347401, -0.4977487028, 0.0808113366, 0.0075054937, -0.196670264, -0.2570158243, 0.2851541042, 0.0231733527, -0.0891862512, -0.2323271334, 0.0862705857, 0.1931112707, -0.0923557654, -0.6234654784, 0.5602855682, 0.5223326683, 0.0226685517, 0.1969810724, 0.4178994298, 0.0167536922, 0.0668814704, -0.1525680721, 0.1664797515, 0.108337976, 0.0184075478, -0.2958196998, 0.0697328448, 0.2497303188, 0.176126644, -0.2609068155, -0.1829364002, -0.1405119002, -0.0761567578, -0.027982302, 0.1387431324, -0.412086755, 0.3359062672, 0.6934579611, -0.0322733931, 0.2642436028, 0.0308322143, -0.3138767779, -0.1533605307, 0.2285322994, -0.121576108, 0.2470547557, 0.0851404965, 0.3608530462, -0.1999172121, -0.1625252664, -0.0748270974, 0.2153989673, 0.0469215475, 0.066360496, 0.0049410686, 0.0751007944, 0.1541918069, -0.1057288423, 0.270960331, -0.050399214, 0.2032076865, -0.4259134829, 0.2171180844, -0.4016539156, 0.0512691885, -0.2296756506, -0.0917816535, -0.0777891427, -0.2456136942, -0.029358454, 0.0008401984, -0.2700946927, 0.3935127854, 0.261487782, 0.1166922301, 0.0873443782, -0.2350943983, -0.1146133393, -0.1724233478, -0.2385482937, 0.0400343835, 0.2083547562, -0.3795829415, 0.1849568784, 0.3574535549, -0.2676814795, -0.2696790695, -0.7421149015, 0.0485984981, -0.2355481535, 0.0960822403, 0.0381218642, 0.1293120533, -0.0246390738, 0.0510536842, 0.0254741982, 0.0944768637, -0.0181040298, 0.1180342361, -0.1916360706, 0.0291311108, -0.2872899771, -0.2801524401, -0.0367826261, -0.1219953895, 0.1812553108, -0.0798304155, -0.0676225722, 0.051486019, 0.0912295803, 0.0310504343, -0.0581302866, 0.2310896814, -0.4207526743, 0.0914393738, 0.3349054158, -0.1597367972, -0.3068856895, -0.1432786584, 0.0234636851, -0.0182585474, 0.0745136663, -0.2800923288, -0.0570337065, -0.2157624066, 0.2658352554, -0.0140342647, -0.1009147987, 0.5142833591, 0.2329594791, 0.0712706372, -0.0603919588, 0.0153216971, 0.0630326793, 0.2177912444, 0.2721603215, -0.0094197551, 0.3699365258, 0.1042172089, 0.358104676, 0.2943381369, -0.6948934793, -0.1260362267, -0.0573533475, 0.2153843343, -0.2174503505, -0.2911498845, 0.032002978, -0.2955262661, -0.1989387572, 0.0065345615, -0.2766372561, -0.27709198, 0.1184649467, 0.23312141, 0.1338420063, -0.4014646113, 0.4034070671, -0.3055262864, -0.0188107193, 0.0703194365, 0.1725527942, -0.1366493553, -0.1540072858, 0.1249558404, 0.0767138973, 0.139078021, -0.0452392176, -0.1560619026, -0.1616588086, -0.5573340058, 0.2960478961, 0.0733387917, 0.3998684883, -0.1019987166, -0.3138101399, -0.1236896515, 0.2658504844, 0.3583014011, -0.0651800483, -0.308555454, -0.0340752527, 0.0468398519, -0.1119084284, 0.0908224061, -0.3705393672, 0.1399976462, 0.1598603427, 0.4799209535, -0.3152982593, -0.1501233131, 0.3407088816, 0.099006094, -0.2651866376, 0.1257001609, -0.3059802949, -0.2172535956, 0.1029195487, -0.1605291069, 0.3218425214, -0.1130136028, -0.1629985273, -0.1421162337, -0.1887492388, -0.059386801, 0.3024403751, -0.0537966341, 0.1746543795, 0.2735583782, -0.0524261557, 0.1738077402, 0.4484736323, 0.0710391104, 0.3958068192, -0.2539946139, -0.4725270867, 0.1205895767, 0.2626000047, 0.2191856503, 0.3360379338, -0.0665045381, -0.010750385, 0.0495240651, 0.2013030201, -0.4152362645, 0.1450720429, 0.3002060652, 0.4395446181, -0.3818067312, -0.3916045427, 0.3398995697, 0.1049044877, -0.1118495911, 0.3452865183, -0.3406516612, -0.4210638106, 0.4126034677, 0.4866727591, 0.943916738, -0.0515247472, 0.362306416, 0.3886759877, 0.0395121686, 0.7027944922, -0.2195881456, 0.0953719318, -0.1092885211, -0.2003382295, -0.1821271628, 0.0283359047, 0.1922813207, -0.1768276989, -0.3934646249, -0.0114230281, 0.0450146757, 0.3950941563, 0.0918087438, 0.1370072663, 0.1337353289, -0.3839353919, 0.0010397994, 0.0962076858, -0.1420922279, -0.0245581381, 0.0258368067, -0.1296159476, -0.2271974832, -0.0388556048, -0.2351936102, -0.2038244754, -0.6721234322, 0.2279057205, -0.211289674, -0.3824327886, 0.2119165212, 0.3805317283, 0.4986091554, 0.0699414089, -0.1444130987, -0.0541000962, 0.1406934261, 0.2504909635, 0.3674526513, -0.3385371864, 0.5262501836, 0.1788808107, -0.0170451142, -0.0523226932, 0.0190298893, 0.1195789799, -0.3839369118, -0.0444363579, 0.0104463864, -0.4486306608, 0.0180259552, 0.0518194735, 0.1929471791, -0.0719196573, 0.0803572834, 0.0033200521, 0.0604199059, 0.4390887916, -0.2384053767, -0.2049400061, -0.1360177696, 0.2581451833, 0.3120487332, -0.0276792869, 0.3316818774, 0.174864769, -0.2199062258, -0.1326007247, 0.2696623504, 0.0962476879, -0.2718691826, 0.2938763201, -0.2294579893, -0.3275021315, -0.4029335082, 0.0242936797, 0.1296148896, 0.0200840458, -0.4275779426, 0.0481218994, -0.4269219637, 0.1955788732, 0.1994591206, 0.229496792, -0.0968035534, 0.2902585566, -0.1862213463, -0.075258106, -0.2788594961, -0.1454712451, 0.2015165836, 0.1607855707, -0.0480513461, -0.0622586682, 0.2153781354, -0.2433128357, 0.0800852329, 0.0955786183, 0.0832245201, -0.1688764095, -0.1338003278, 0.08440312, -0.0721535534, -0.1631307304, -0.0209845882, -0.1953464001, -0.1867279559, -0.1678043306, 0.1126664579, 0.2799354196, 0.1018422768, 0.2763631642, 0.0417337976, 0.1626679152, 0.3086151183, 0.0054952968, -0.1270997375, 0.2509422898, 0.0635593534, 0.3367978334, 0.0193026159, -0.0522143804, -0.1994489133, 0.2303502113, 0.0502554253, -0.0898419246, 0.4385260046, -0.186291486, -0.1380276829, 0.0113267563, 0.1839897335, 0.2505348921, -0.3121964633, -0.1436042935, -0.0271204785, 0.108014375, -0.184605509, 0.1011113524, 0.1920876652, -0.1086050123, 0.1267402768, 0.4136992395, -0.0296266843, 0.563444674, -0.0397621393, -0.0074643269, 0.1605864912, -0.2002459317, 0.2797860205, 0.2631993592, -0.0898273513, 0.1576703489, 0.2914582193, 0.079915382, 0.1357222646, 0.1433385015, 0.047520455, 0.2089090794, 0.0597947538, 0.0278487951, 0.4162572622, -0.1557867229, 0.1227425784, 0.090849556, -0.4397898614, 0.2601423264, 0.382668674, 0.0751200244, -0.3052259684, -0.235990718, -0.1305060834, 0.1503943354, -0.4149082601, 0.0025798257, -0.2539521456, 0.0859752968, -0.061961785, -0.2450639904, -0.2087458223, -0.047356341, 0.2073628157, 0.203363359, -0.1458739638, 0.0916261896, -0.2127765715, -0.1652699709, 0.0895996988, 0.0469893999, 0.3118063509, 0.3976687789, -0.1903302968, -0.164062649, 0.2795583904, 0.2608895898, 0.1900887042, -0.2551003695, 0.3188131452, 0.1368777454, -0.282248944, 0.0019032928, 0.2594350874, 0.0223128516, -0.018163031, 0.2152705789, 0.103710711, -0.0287231226, 0.1587680727, -0.0829134285, 0.2346435785, 0.0197712071, 0.6455356479, -0.0429135486, -0.1467238069, -0.0784747973, -0.20738554, -0.2123954594, -0.2224060744, 0.771080792, -0.1710175723, 0.2005573511, -0.0775001198, 0.0657909587, 0.2825327218, 0.3724640608, 0.0875460356, -0.0523023643, -0.218770504, 0.3671227098, -0.2781037688, 0.1055850387, 0.2141845077, -0.0478556007, -0.0218305662, 0.2236843854, 0.439227283, 0.2588708103, 0.0447613187, -0.4173417985, 0.2164111882, 0.0331134945, -0.1054256782, -0.2507252097, -0.4146490097, 0.1806096882, 0.0294063296, -0.349801898, 0.3316434622, 0.1330268532, -0.0241065975, -0.474532932, 0.0894953012, -0.0053972779, 0.2187123448, 0.2378495485, 0.4377464056, 0.1268992126, -0.129606396, -0.2555924952, 0.1482960135, -0.0524919853, -0.4803516269, 0.4116390646, -0.1601351053, 0.3657148182, -0.3011514544, -0.2907637954, -0.1951592863, 0.0258602612, 0.0851695091, -0.4364661276, -0.5503333211, 0.3894614577, -0.1322180629, -0.0845065489, 0.2017909735, 0.4802951515, 0.0986784175, 0.3818569779, -0.2019929439, -0.3419236839, 0.6405501366, -0.2690972686, -0.0412025563, -0.0623359419, -0.0725636035, -0.0648595169, 0.0509314537, -0.8520143628, -0.23993285, 0.2974299192, -0.2665517926, -0.2482234538, 0.309158653, 0.1196829006, 0.1341455579, -0.3145250976, 0.5315726995, -0.0456144363, -0.1521999985, 0.0940457582, -0.188225925 ]
https://github.com/huggingface/datasets/issues/625
dtype of tensors should be preserved
If the arrow format is basically lists, why is the intermediate step to numpy necessary? I am a bit confused about that part. Thanks for your suggestion. as I have currently implemented this, I cast to torch.Tensor in my collate_fn to save disk space (so I do not have to save padded tensors to max_len but can pad up to max batch len in collate_fn) at the cost of a bit slower processing. So for me this is not relevant anymore, but I am sure it is for others!
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
89
dtype of tensors should be preserved After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. If the arrow format is basically lists, why is the intermediate step to numpy necessary? I am a bit confused about that part. Thanks for your suggestion. as I have currently implemented this, I cast to torch.Tensor in my collate_fn to save disk space (so I do not have to save padded tensors to max_len but can pad up to max batch len in collate_fn) at the cost of a bit slower processing. So for me this is not relevant anymore, but I am sure it is for others!
[ -0.1134336665, -0.221115008, -0.0097108139, 0.2073050439, 0.5532283783, 0.1730132401, 0.5313699245, 0.1225807741, 0.1504824311, -0.0665397719, -0.0843991637, 0.2457148433, -0.117551893, -0.1751451641, 0.1026155949, -0.2025275528, 0.2282531559, -0.0652568489, -0.1441735029, -0.2050459683, -0.2274059653, -0.0888314694, -0.0027087252, -0.2082730085, -0.1601843834, -0.1640593857, 0.240316391, -0.1392812878, -0.185163781, -0.0010071729, 0.1801279187, -0.1652226001, 0.4167293906, 0.5717648268, -0.0001163156, 0.2217251658, -0.0266849883, -0.0754260495, -0.1886362731, -0.0001531355, 0.0046073291, -0.1931505948, -0.0723767504, -0.1798607111, -0.1541207731, -0.1833255589, -0.0845146552, -0.7935449481, 0.2889487147, 0.4108265638, 0.1519325376, 0.2570817769, 0.0712020621, 0.1525933743, -0.1351299435, 0.2725166082, -0.1030128226, 0.2802624106, -0.0208768621, 0.3604670167, -0.0614816993, 0.4459063411, -0.3614789546, -0.0750736743, 0.0291569643, 0.1127889976, 0.0541250817, -0.4639117718, -0.0662837625, 0.1654173583, 0.1973417401, -0.2320811003, -0.2843653858, -0.1672888547, -0.0933568701, -0.367162168, 0.0662379116, -0.0845818296, 0.1454868317, 0.1031548604, -0.0847082958, -0.1715695858, -0.0345696211, 0.1320960969, -0.4753401279, 0.2185825855, -0.0089361332, 0.1474191248, -0.1035435423, -0.0327193514, 0.074318178, -0.115951173, 0.2209848762, -0.0332038701, -0.1700054407, -0.223601684, 0.1068102717, -0.4505301416, -0.1278469265, -0.48186782, 0.2282643914, 0.1562224776, -0.2183921039, -0.0274901204, 0.210150376, 0.3317387402, -0.297642678, 0.3678761423, 0.2994465232, -0.0447377264, 0.2111327052, 0.0985191241, 0.1282293648, 0.046433866, -0.0115374792, 0.1037945673, 0.5391175747, -0.1061271951, -0.3156948388, 0.2423451692, -0.4640919268, 0.0854393989, 0.0290507134, 0.0762219205, -0.1580675989, 0.4469194114, 0.1909369379, 0.0856406093, -0.1537801474, -0.0482110791, -0.1408703178, -0.246330142, 0.0493122563, -0.175722912, 0.047348123, 0.1110769287, -0.0556812771, 0.290984422, 0.1304949522, 0.1616607606, -0.0623955205, -0.1468251497, 0.5156328082, 0.2943933308, -0.3300796449, 0.1609630883, 0.2148126066, -0.3500459194, -0.1941232532, 0.34138304, -0.2835558653, 0.0002673641, -0.2552974522, 0.0896735564, -0.0626334995, -0.1942969412, 0.0383377522, 0.5168799162, 0.5945782661, 0.0745409727, 0.3335528076, -0.5255038142, -0.2444201857, -0.2121092975, 0.0651088804, -0.0023092092, -0.4651452303, -0.0084926235, 0.2366490513, 0.1842956841, 0.3561902046, 0.4137145579, 0.0704918802, 0.1077741235, 0.0749111027, -0.0053550522, 0.4220858514, 0.1117162332, -0.2204667777, -0.0649490207, -0.05865575, 0.3635669947, -0.080704838, 0.0079565262, 0.3194954395, -0.2035728544, 0.2078324556, 0.0254101828, -0.2768172026, 0.0815220773, -0.2061397731, 0.0387926735, 0.4647623003, -0.0825524554, -0.0355013385, -0.0381801128, -0.3315751553, 0.3626122177, 0.2424905449, -0.1368881017, 0.0368464403, 0.0449778922, 0.0548132509, -0.0328166969, 0.0832959265, -0.0828898773, -0.5234783888, -0.0470568463, 0.0362096876, 0.2670902014, -0.0503190905, -0.1362541914, 0.2245898396, 0.0831877962, -0.0103790052, 0.0391421653, 0.0681505799, -0.171751827, -0.4256083965, 0.0723532289, -0.096664995, -0.2199120224, -0.0393040106, 0.1064347401, -0.4977487028, 0.0808113366, 0.0075054937, -0.196670264, -0.2570158243, 0.2851541042, 0.0231733527, -0.0891862512, -0.2323271334, 0.0862705857, 0.1931112707, -0.0923557654, -0.6234654784, 0.5602855682, 0.5223326683, 0.0226685517, 0.1969810724, 0.4178994298, 0.0167536922, 0.0668814704, -0.1525680721, 0.1664797515, 0.108337976, 0.0184075478, -0.2958196998, 0.0697328448, 0.2497303188, 0.176126644, -0.2609068155, -0.1829364002, -0.1405119002, -0.0761567578, -0.027982302, 0.1387431324, -0.412086755, 0.3359062672, 0.6934579611, -0.0322733931, 0.2642436028, 0.0308322143, -0.3138767779, -0.1533605307, 0.2285322994, -0.121576108, 0.2470547557, 0.0851404965, 0.3608530462, -0.1999172121, -0.1625252664, -0.0748270974, 0.2153989673, 0.0469215475, 0.066360496, 0.0049410686, 0.0751007944, 0.1541918069, -0.1057288423, 0.270960331, -0.050399214, 0.2032076865, -0.4259134829, 0.2171180844, -0.4016539156, 0.0512691885, -0.2296756506, -0.0917816535, -0.0777891427, -0.2456136942, -0.029358454, 0.0008401984, -0.2700946927, 0.3935127854, 0.261487782, 0.1166922301, 0.0873443782, -0.2350943983, -0.1146133393, -0.1724233478, -0.2385482937, 0.0400343835, 0.2083547562, -0.3795829415, 0.1849568784, 0.3574535549, -0.2676814795, -0.2696790695, -0.7421149015, 0.0485984981, -0.2355481535, 0.0960822403, 0.0381218642, 0.1293120533, -0.0246390738, 0.0510536842, 0.0254741982, 0.0944768637, -0.0181040298, 0.1180342361, -0.1916360706, 0.0291311108, -0.2872899771, -0.2801524401, -0.0367826261, -0.1219953895, 0.1812553108, -0.0798304155, -0.0676225722, 0.051486019, 0.0912295803, 0.0310504343, -0.0581302866, 0.2310896814, -0.4207526743, 0.0914393738, 0.3349054158, -0.1597367972, -0.3068856895, -0.1432786584, 0.0234636851, -0.0182585474, 0.0745136663, -0.2800923288, -0.0570337065, -0.2157624066, 0.2658352554, -0.0140342647, -0.1009147987, 0.5142833591, 0.2329594791, 0.0712706372, -0.0603919588, 0.0153216971, 0.0630326793, 0.2177912444, 0.2721603215, -0.0094197551, 0.3699365258, 0.1042172089, 0.358104676, 0.2943381369, -0.6948934793, -0.1260362267, -0.0573533475, 0.2153843343, -0.2174503505, -0.2911498845, 0.032002978, -0.2955262661, -0.1989387572, 0.0065345615, -0.2766372561, -0.27709198, 0.1184649467, 0.23312141, 0.1338420063, -0.4014646113, 0.4034070671, -0.3055262864, -0.0188107193, 0.0703194365, 0.1725527942, -0.1366493553, -0.1540072858, 0.1249558404, 0.0767138973, 0.139078021, -0.0452392176, -0.1560619026, -0.1616588086, -0.5573340058, 0.2960478961, 0.0733387917, 0.3998684883, -0.1019987166, -0.3138101399, -0.1236896515, 0.2658504844, 0.3583014011, -0.0651800483, -0.308555454, -0.0340752527, 0.0468398519, -0.1119084284, 0.0908224061, -0.3705393672, 0.1399976462, 0.1598603427, 0.4799209535, -0.3152982593, -0.1501233131, 0.3407088816, 0.099006094, -0.2651866376, 0.1257001609, -0.3059802949, -0.2172535956, 0.1029195487, -0.1605291069, 0.3218425214, -0.1130136028, -0.1629985273, -0.1421162337, -0.1887492388, -0.059386801, 0.3024403751, -0.0537966341, 0.1746543795, 0.2735583782, -0.0524261557, 0.1738077402, 0.4484736323, 0.0710391104, 0.3958068192, -0.2539946139, -0.4725270867, 0.1205895767, 0.2626000047, 0.2191856503, 0.3360379338, -0.0665045381, -0.010750385, 0.0495240651, 0.2013030201, -0.4152362645, 0.1450720429, 0.3002060652, 0.4395446181, -0.3818067312, -0.3916045427, 0.3398995697, 0.1049044877, -0.1118495911, 0.3452865183, -0.3406516612, -0.4210638106, 0.4126034677, 0.4866727591, 0.943916738, -0.0515247472, 0.362306416, 0.3886759877, 0.0395121686, 0.7027944922, -0.2195881456, 0.0953719318, -0.1092885211, -0.2003382295, -0.1821271628, 0.0283359047, 0.1922813207, -0.1768276989, -0.3934646249, -0.0114230281, 0.0450146757, 0.3950941563, 0.0918087438, 0.1370072663, 0.1337353289, -0.3839353919, 0.0010397994, 0.0962076858, -0.1420922279, -0.0245581381, 0.0258368067, -0.1296159476, -0.2271974832, -0.0388556048, -0.2351936102, -0.2038244754, -0.6721234322, 0.2279057205, -0.211289674, -0.3824327886, 0.2119165212, 0.3805317283, 0.4986091554, 0.0699414089, -0.1444130987, -0.0541000962, 0.1406934261, 0.2504909635, 0.3674526513, -0.3385371864, 0.5262501836, 0.1788808107, -0.0170451142, -0.0523226932, 0.0190298893, 0.1195789799, -0.3839369118, -0.0444363579, 0.0104463864, -0.4486306608, 0.0180259552, 0.0518194735, 0.1929471791, -0.0719196573, 0.0803572834, 0.0033200521, 0.0604199059, 0.4390887916, -0.2384053767, -0.2049400061, -0.1360177696, 0.2581451833, 0.3120487332, -0.0276792869, 0.3316818774, 0.174864769, -0.2199062258, -0.1326007247, 0.2696623504, 0.0962476879, -0.2718691826, 0.2938763201, -0.2294579893, -0.3275021315, -0.4029335082, 0.0242936797, 0.1296148896, 0.0200840458, -0.4275779426, 0.0481218994, -0.4269219637, 0.1955788732, 0.1994591206, 0.229496792, -0.0968035534, 0.2902585566, -0.1862213463, -0.075258106, -0.2788594961, -0.1454712451, 0.2015165836, 0.1607855707, -0.0480513461, -0.0622586682, 0.2153781354, -0.2433128357, 0.0800852329, 0.0955786183, 0.0832245201, -0.1688764095, -0.1338003278, 0.08440312, -0.0721535534, -0.1631307304, -0.0209845882, -0.1953464001, -0.1867279559, -0.1678043306, 0.1126664579, 0.2799354196, 0.1018422768, 0.2763631642, 0.0417337976, 0.1626679152, 0.3086151183, 0.0054952968, -0.1270997375, 0.2509422898, 0.0635593534, 0.3367978334, 0.0193026159, -0.0522143804, -0.1994489133, 0.2303502113, 0.0502554253, -0.0898419246, 0.4385260046, -0.186291486, -0.1380276829, 0.0113267563, 0.1839897335, 0.2505348921, -0.3121964633, -0.1436042935, -0.0271204785, 0.108014375, -0.184605509, 0.1011113524, 0.1920876652, -0.1086050123, 0.1267402768, 0.4136992395, -0.0296266843, 0.563444674, -0.0397621393, -0.0074643269, 0.1605864912, -0.2002459317, 0.2797860205, 0.2631993592, -0.0898273513, 0.1576703489, 0.2914582193, 0.079915382, 0.1357222646, 0.1433385015, 0.047520455, 0.2089090794, 0.0597947538, 0.0278487951, 0.4162572622, -0.1557867229, 0.1227425784, 0.090849556, -0.4397898614, 0.2601423264, 0.382668674, 0.0751200244, -0.3052259684, -0.235990718, -0.1305060834, 0.1503943354, -0.4149082601, 0.0025798257, -0.2539521456, 0.0859752968, -0.061961785, -0.2450639904, -0.2087458223, -0.047356341, 0.2073628157, 0.203363359, -0.1458739638, 0.0916261896, -0.2127765715, -0.1652699709, 0.0895996988, 0.0469893999, 0.3118063509, 0.3976687789, -0.1903302968, -0.164062649, 0.2795583904, 0.2608895898, 0.1900887042, -0.2551003695, 0.3188131452, 0.1368777454, -0.282248944, 0.0019032928, 0.2594350874, 0.0223128516, -0.018163031, 0.2152705789, 0.103710711, -0.0287231226, 0.1587680727, -0.0829134285, 0.2346435785, 0.0197712071, 0.6455356479, -0.0429135486, -0.1467238069, -0.0784747973, -0.20738554, -0.2123954594, -0.2224060744, 0.771080792, -0.1710175723, 0.2005573511, -0.0775001198, 0.0657909587, 0.2825327218, 0.3724640608, 0.0875460356, -0.0523023643, -0.218770504, 0.3671227098, -0.2781037688, 0.1055850387, 0.2141845077, -0.0478556007, -0.0218305662, 0.2236843854, 0.439227283, 0.2588708103, 0.0447613187, -0.4173417985, 0.2164111882, 0.0331134945, -0.1054256782, -0.2507252097, -0.4146490097, 0.1806096882, 0.0294063296, -0.349801898, 0.3316434622, 0.1330268532, -0.0241065975, -0.474532932, 0.0894953012, -0.0053972779, 0.2187123448, 0.2378495485, 0.4377464056, 0.1268992126, -0.129606396, -0.2555924952, 0.1482960135, -0.0524919853, -0.4803516269, 0.4116390646, -0.1601351053, 0.3657148182, -0.3011514544, -0.2907637954, -0.1951592863, 0.0258602612, 0.0851695091, -0.4364661276, -0.5503333211, 0.3894614577, -0.1322180629, -0.0845065489, 0.2017909735, 0.4802951515, 0.0986784175, 0.3818569779, -0.2019929439, -0.3419236839, 0.6405501366, -0.2690972686, -0.0412025563, -0.0623359419, -0.0725636035, -0.0648595169, 0.0509314537, -0.8520143628, -0.23993285, 0.2974299192, -0.2665517926, -0.2482234538, 0.309158653, 0.1196829006, 0.1341455579, -0.3145250976, 0.5315726995, -0.0456144363, -0.1521999985, 0.0940457582, -0.188225925 ]
https://github.com/huggingface/datasets/issues/625
dtype of tensors should be preserved
I'm glad you managed to figure something out :) Casting from arrow to numpy can be 100x faster than casting from arrow to list. This is because arrow has an integration with numpy that allows it to instantiate numpy arrays with zero-copy from arrow. On the other hand to create python lists it is slow since it has to recreate the list object by iterating through each element in python.
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
70
dtype of tensors should be preserved After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. I'm glad you managed to figure something out :) Casting from arrow to numpy can be 100x faster than casting from arrow to list. This is because arrow has an integration with numpy that allows it to instantiate numpy arrays with zero-copy from arrow. On the other hand to create python lists it is slow since it has to recreate the list object by iterating through each element in python.
[ -0.1134336665, -0.221115008, -0.0097108139, 0.2073050439, 0.5532283783, 0.1730132401, 0.5313699245, 0.1225807741, 0.1504824311, -0.0665397719, -0.0843991637, 0.2457148433, -0.117551893, -0.1751451641, 0.1026155949, -0.2025275528, 0.2282531559, -0.0652568489, -0.1441735029, -0.2050459683, -0.2274059653, -0.0888314694, -0.0027087252, -0.2082730085, -0.1601843834, -0.1640593857, 0.240316391, -0.1392812878, -0.185163781, -0.0010071729, 0.1801279187, -0.1652226001, 0.4167293906, 0.5717648268, -0.0001163156, 0.2217251658, -0.0266849883, -0.0754260495, -0.1886362731, -0.0001531355, 0.0046073291, -0.1931505948, -0.0723767504, -0.1798607111, -0.1541207731, -0.1833255589, -0.0845146552, -0.7935449481, 0.2889487147, 0.4108265638, 0.1519325376, 0.2570817769, 0.0712020621, 0.1525933743, -0.1351299435, 0.2725166082, -0.1030128226, 0.2802624106, -0.0208768621, 0.3604670167, -0.0614816993, 0.4459063411, -0.3614789546, -0.0750736743, 0.0291569643, 0.1127889976, 0.0541250817, -0.4639117718, -0.0662837625, 0.1654173583, 0.1973417401, -0.2320811003, -0.2843653858, -0.1672888547, -0.0933568701, -0.367162168, 0.0662379116, -0.0845818296, 0.1454868317, 0.1031548604, -0.0847082958, -0.1715695858, -0.0345696211, 0.1320960969, -0.4753401279, 0.2185825855, -0.0089361332, 0.1474191248, -0.1035435423, -0.0327193514, 0.074318178, -0.115951173, 0.2209848762, -0.0332038701, -0.1700054407, -0.223601684, 0.1068102717, -0.4505301416, -0.1278469265, -0.48186782, 0.2282643914, 0.1562224776, -0.2183921039, -0.0274901204, 0.210150376, 0.3317387402, -0.297642678, 0.3678761423, 0.2994465232, -0.0447377264, 0.2111327052, 0.0985191241, 0.1282293648, 0.046433866, -0.0115374792, 0.1037945673, 0.5391175747, -0.1061271951, -0.3156948388, 0.2423451692, -0.4640919268, 0.0854393989, 0.0290507134, 0.0762219205, -0.1580675989, 0.4469194114, 0.1909369379, 0.0856406093, -0.1537801474, -0.0482110791, -0.1408703178, -0.246330142, 0.0493122563, -0.175722912, 0.047348123, 0.1110769287, -0.0556812771, 0.290984422, 0.1304949522, 0.1616607606, -0.0623955205, -0.1468251497, 0.5156328082, 0.2943933308, -0.3300796449, 0.1609630883, 0.2148126066, -0.3500459194, -0.1941232532, 0.34138304, -0.2835558653, 0.0002673641, -0.2552974522, 0.0896735564, -0.0626334995, -0.1942969412, 0.0383377522, 0.5168799162, 0.5945782661, 0.0745409727, 0.3335528076, -0.5255038142, -0.2444201857, -0.2121092975, 0.0651088804, -0.0023092092, -0.4651452303, -0.0084926235, 0.2366490513, 0.1842956841, 0.3561902046, 0.4137145579, 0.0704918802, 0.1077741235, 0.0749111027, -0.0053550522, 0.4220858514, 0.1117162332, -0.2204667777, -0.0649490207, -0.05865575, 0.3635669947, -0.080704838, 0.0079565262, 0.3194954395, -0.2035728544, 0.2078324556, 0.0254101828, -0.2768172026, 0.0815220773, -0.2061397731, 0.0387926735, 0.4647623003, -0.0825524554, -0.0355013385, -0.0381801128, -0.3315751553, 0.3626122177, 0.2424905449, -0.1368881017, 0.0368464403, 0.0449778922, 0.0548132509, -0.0328166969, 0.0832959265, -0.0828898773, -0.5234783888, -0.0470568463, 0.0362096876, 0.2670902014, -0.0503190905, -0.1362541914, 0.2245898396, 0.0831877962, -0.0103790052, 0.0391421653, 0.0681505799, -0.171751827, -0.4256083965, 0.0723532289, -0.096664995, -0.2199120224, -0.0393040106, 0.1064347401, -0.4977487028, 0.0808113366, 0.0075054937, -0.196670264, -0.2570158243, 0.2851541042, 0.0231733527, -0.0891862512, -0.2323271334, 0.0862705857, 0.1931112707, -0.0923557654, -0.6234654784, 0.5602855682, 0.5223326683, 0.0226685517, 0.1969810724, 0.4178994298, 0.0167536922, 0.0668814704, -0.1525680721, 0.1664797515, 0.108337976, 0.0184075478, -0.2958196998, 0.0697328448, 0.2497303188, 0.176126644, -0.2609068155, -0.1829364002, -0.1405119002, -0.0761567578, -0.027982302, 0.1387431324, -0.412086755, 0.3359062672, 0.6934579611, -0.0322733931, 0.2642436028, 0.0308322143, -0.3138767779, -0.1533605307, 0.2285322994, -0.121576108, 0.2470547557, 0.0851404965, 0.3608530462, -0.1999172121, -0.1625252664, -0.0748270974, 0.2153989673, 0.0469215475, 0.066360496, 0.0049410686, 0.0751007944, 0.1541918069, -0.1057288423, 0.270960331, -0.050399214, 0.2032076865, -0.4259134829, 0.2171180844, -0.4016539156, 0.0512691885, -0.2296756506, -0.0917816535, -0.0777891427, -0.2456136942, -0.029358454, 0.0008401984, -0.2700946927, 0.3935127854, 0.261487782, 0.1166922301, 0.0873443782, -0.2350943983, -0.1146133393, -0.1724233478, -0.2385482937, 0.0400343835, 0.2083547562, -0.3795829415, 0.1849568784, 0.3574535549, -0.2676814795, -0.2696790695, -0.7421149015, 0.0485984981, -0.2355481535, 0.0960822403, 0.0381218642, 0.1293120533, -0.0246390738, 0.0510536842, 0.0254741982, 0.0944768637, -0.0181040298, 0.1180342361, -0.1916360706, 0.0291311108, -0.2872899771, -0.2801524401, -0.0367826261, -0.1219953895, 0.1812553108, -0.0798304155, -0.0676225722, 0.051486019, 0.0912295803, 0.0310504343, -0.0581302866, 0.2310896814, -0.4207526743, 0.0914393738, 0.3349054158, -0.1597367972, -0.3068856895, -0.1432786584, 0.0234636851, -0.0182585474, 0.0745136663, -0.2800923288, -0.0570337065, -0.2157624066, 0.2658352554, -0.0140342647, -0.1009147987, 0.5142833591, 0.2329594791, 0.0712706372, -0.0603919588, 0.0153216971, 0.0630326793, 0.2177912444, 0.2721603215, -0.0094197551, 0.3699365258, 0.1042172089, 0.358104676, 0.2943381369, -0.6948934793, -0.1260362267, -0.0573533475, 0.2153843343, -0.2174503505, -0.2911498845, 0.032002978, -0.2955262661, -0.1989387572, 0.0065345615, -0.2766372561, -0.27709198, 0.1184649467, 0.23312141, 0.1338420063, -0.4014646113, 0.4034070671, -0.3055262864, -0.0188107193, 0.0703194365, 0.1725527942, -0.1366493553, -0.1540072858, 0.1249558404, 0.0767138973, 0.139078021, -0.0452392176, -0.1560619026, -0.1616588086, -0.5573340058, 0.2960478961, 0.0733387917, 0.3998684883, -0.1019987166, -0.3138101399, -0.1236896515, 0.2658504844, 0.3583014011, -0.0651800483, -0.308555454, -0.0340752527, 0.0468398519, -0.1119084284, 0.0908224061, -0.3705393672, 0.1399976462, 0.1598603427, 0.4799209535, -0.3152982593, -0.1501233131, 0.3407088816, 0.099006094, -0.2651866376, 0.1257001609, -0.3059802949, -0.2172535956, 0.1029195487, -0.1605291069, 0.3218425214, -0.1130136028, -0.1629985273, -0.1421162337, -0.1887492388, -0.059386801, 0.3024403751, -0.0537966341, 0.1746543795, 0.2735583782, -0.0524261557, 0.1738077402, 0.4484736323, 0.0710391104, 0.3958068192, -0.2539946139, -0.4725270867, 0.1205895767, 0.2626000047, 0.2191856503, 0.3360379338, -0.0665045381, -0.010750385, 0.0495240651, 0.2013030201, -0.4152362645, 0.1450720429, 0.3002060652, 0.4395446181, -0.3818067312, -0.3916045427, 0.3398995697, 0.1049044877, -0.1118495911, 0.3452865183, -0.3406516612, -0.4210638106, 0.4126034677, 0.4866727591, 0.943916738, -0.0515247472, 0.362306416, 0.3886759877, 0.0395121686, 0.7027944922, -0.2195881456, 0.0953719318, -0.1092885211, -0.2003382295, -0.1821271628, 0.0283359047, 0.1922813207, -0.1768276989, -0.3934646249, -0.0114230281, 0.0450146757, 0.3950941563, 0.0918087438, 0.1370072663, 0.1337353289, -0.3839353919, 0.0010397994, 0.0962076858, -0.1420922279, -0.0245581381, 0.0258368067, -0.1296159476, -0.2271974832, -0.0388556048, -0.2351936102, -0.2038244754, -0.6721234322, 0.2279057205, -0.211289674, -0.3824327886, 0.2119165212, 0.3805317283, 0.4986091554, 0.0699414089, -0.1444130987, -0.0541000962, 0.1406934261, 0.2504909635, 0.3674526513, -0.3385371864, 0.5262501836, 0.1788808107, -0.0170451142, -0.0523226932, 0.0190298893, 0.1195789799, -0.3839369118, -0.0444363579, 0.0104463864, -0.4486306608, 0.0180259552, 0.0518194735, 0.1929471791, -0.0719196573, 0.0803572834, 0.0033200521, 0.0604199059, 0.4390887916, -0.2384053767, -0.2049400061, -0.1360177696, 0.2581451833, 0.3120487332, -0.0276792869, 0.3316818774, 0.174864769, -0.2199062258, -0.1326007247, 0.2696623504, 0.0962476879, -0.2718691826, 0.2938763201, -0.2294579893, -0.3275021315, -0.4029335082, 0.0242936797, 0.1296148896, 0.0200840458, -0.4275779426, 0.0481218994, -0.4269219637, 0.1955788732, 0.1994591206, 0.229496792, -0.0968035534, 0.2902585566, -0.1862213463, -0.075258106, -0.2788594961, -0.1454712451, 0.2015165836, 0.1607855707, -0.0480513461, -0.0622586682, 0.2153781354, -0.2433128357, 0.0800852329, 0.0955786183, 0.0832245201, -0.1688764095, -0.1338003278, 0.08440312, -0.0721535534, -0.1631307304, -0.0209845882, -0.1953464001, -0.1867279559, -0.1678043306, 0.1126664579, 0.2799354196, 0.1018422768, 0.2763631642, 0.0417337976, 0.1626679152, 0.3086151183, 0.0054952968, -0.1270997375, 0.2509422898, 0.0635593534, 0.3367978334, 0.0193026159, -0.0522143804, -0.1994489133, 0.2303502113, 0.0502554253, -0.0898419246, 0.4385260046, -0.186291486, -0.1380276829, 0.0113267563, 0.1839897335, 0.2505348921, -0.3121964633, -0.1436042935, -0.0271204785, 0.108014375, -0.184605509, 0.1011113524, 0.1920876652, -0.1086050123, 0.1267402768, 0.4136992395, -0.0296266843, 0.563444674, -0.0397621393, -0.0074643269, 0.1605864912, -0.2002459317, 0.2797860205, 0.2631993592, -0.0898273513, 0.1576703489, 0.2914582193, 0.079915382, 0.1357222646, 0.1433385015, 0.047520455, 0.2089090794, 0.0597947538, 0.0278487951, 0.4162572622, -0.1557867229, 0.1227425784, 0.090849556, -0.4397898614, 0.2601423264, 0.382668674, 0.0751200244, -0.3052259684, -0.235990718, -0.1305060834, 0.1503943354, -0.4149082601, 0.0025798257, -0.2539521456, 0.0859752968, -0.061961785, -0.2450639904, -0.2087458223, -0.047356341, 0.2073628157, 0.203363359, -0.1458739638, 0.0916261896, -0.2127765715, -0.1652699709, 0.0895996988, 0.0469893999, 0.3118063509, 0.3976687789, -0.1903302968, -0.164062649, 0.2795583904, 0.2608895898, 0.1900887042, -0.2551003695, 0.3188131452, 0.1368777454, -0.282248944, 0.0019032928, 0.2594350874, 0.0223128516, -0.018163031, 0.2152705789, 0.103710711, -0.0287231226, 0.1587680727, -0.0829134285, 0.2346435785, 0.0197712071, 0.6455356479, -0.0429135486, -0.1467238069, -0.0784747973, -0.20738554, -0.2123954594, -0.2224060744, 0.771080792, -0.1710175723, 0.2005573511, -0.0775001198, 0.0657909587, 0.2825327218, 0.3724640608, 0.0875460356, -0.0523023643, -0.218770504, 0.3671227098, -0.2781037688, 0.1055850387, 0.2141845077, -0.0478556007, -0.0218305662, 0.2236843854, 0.439227283, 0.2588708103, 0.0447613187, -0.4173417985, 0.2164111882, 0.0331134945, -0.1054256782, -0.2507252097, -0.4146490097, 0.1806096882, 0.0294063296, -0.349801898, 0.3316434622, 0.1330268532, -0.0241065975, -0.474532932, 0.0894953012, -0.0053972779, 0.2187123448, 0.2378495485, 0.4377464056, 0.1268992126, -0.129606396, -0.2555924952, 0.1482960135, -0.0524919853, -0.4803516269, 0.4116390646, -0.1601351053, 0.3657148182, -0.3011514544, -0.2907637954, -0.1951592863, 0.0258602612, 0.0851695091, -0.4364661276, -0.5503333211, 0.3894614577, -0.1322180629, -0.0845065489, 0.2017909735, 0.4802951515, 0.0986784175, 0.3818569779, -0.2019929439, -0.3419236839, 0.6405501366, -0.2690972686, -0.0412025563, -0.0623359419, -0.0725636035, -0.0648595169, 0.0509314537, -0.8520143628, -0.23993285, 0.2974299192, -0.2665517926, -0.2482234538, 0.309158653, 0.1196829006, 0.1341455579, -0.3145250976, 0.5315726995, -0.0456144363, -0.1521999985, 0.0940457582, -0.188225925 ]
https://github.com/huggingface/datasets/issues/625
dtype of tensors should be preserved
I encountered a simliar issue: `datasets` converted my float numpy array to `torch.float64` tensors, while many pytorch operations require `torch.float32` inputs and it's very troublesome. I tried @lhoestq 's solution, but since it's mixed with the preprocess function, it's not very intuitive. I just want to share another possible simpler solution: directly cast the dtype of the processed dataset. Now I want to change the type of `labels` in `train_dataset` from float64 to float32, I can do this. ``` from datasets import Value, Sequence, Features feats = train_dataset.features.copy() feats['labels'].feature = Value(dtype='float32') feats = Features(feats) train_dataset.cast_(feats) ```
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
96
dtype of tensors should be preserved After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. I encountered a simliar issue: `datasets` converted my float numpy array to `torch.float64` tensors, while many pytorch operations require `torch.float32` inputs and it's very troublesome. I tried @lhoestq 's solution, but since it's mixed with the preprocess function, it's not very intuitive. I just want to share another possible simpler solution: directly cast the dtype of the processed dataset. Now I want to change the type of `labels` in `train_dataset` from float64 to float32, I can do this. ``` from datasets import Value, Sequence, Features feats = train_dataset.features.copy() feats['labels'].feature = Value(dtype='float32') feats = Features(feats) train_dataset.cast_(feats) ```
[ -0.1134336665, -0.221115008, -0.0097108139, 0.2073050439, 0.5532283783, 0.1730132401, 0.5313699245, 0.1225807741, 0.1504824311, -0.0665397719, -0.0843991637, 0.2457148433, -0.117551893, -0.1751451641, 0.1026155949, -0.2025275528, 0.2282531559, -0.0652568489, -0.1441735029, -0.2050459683, -0.2274059653, -0.0888314694, -0.0027087252, -0.2082730085, -0.1601843834, -0.1640593857, 0.240316391, -0.1392812878, -0.185163781, -0.0010071729, 0.1801279187, -0.1652226001, 0.4167293906, 0.5717648268, -0.0001163156, 0.2217251658, -0.0266849883, -0.0754260495, -0.1886362731, -0.0001531355, 0.0046073291, -0.1931505948, -0.0723767504, -0.1798607111, -0.1541207731, -0.1833255589, -0.0845146552, -0.7935449481, 0.2889487147, 0.4108265638, 0.1519325376, 0.2570817769, 0.0712020621, 0.1525933743, -0.1351299435, 0.2725166082, -0.1030128226, 0.2802624106, -0.0208768621, 0.3604670167, -0.0614816993, 0.4459063411, -0.3614789546, -0.0750736743, 0.0291569643, 0.1127889976, 0.0541250817, -0.4639117718, -0.0662837625, 0.1654173583, 0.1973417401, -0.2320811003, -0.2843653858, -0.1672888547, -0.0933568701, -0.367162168, 0.0662379116, -0.0845818296, 0.1454868317, 0.1031548604, -0.0847082958, -0.1715695858, -0.0345696211, 0.1320960969, -0.4753401279, 0.2185825855, -0.0089361332, 0.1474191248, -0.1035435423, -0.0327193514, 0.074318178, -0.115951173, 0.2209848762, -0.0332038701, -0.1700054407, -0.223601684, 0.1068102717, -0.4505301416, -0.1278469265, -0.48186782, 0.2282643914, 0.1562224776, -0.2183921039, -0.0274901204, 0.210150376, 0.3317387402, -0.297642678, 0.3678761423, 0.2994465232, -0.0447377264, 0.2111327052, 0.0985191241, 0.1282293648, 0.046433866, -0.0115374792, 0.1037945673, 0.5391175747, -0.1061271951, -0.3156948388, 0.2423451692, -0.4640919268, 0.0854393989, 0.0290507134, 0.0762219205, -0.1580675989, 0.4469194114, 0.1909369379, 0.0856406093, -0.1537801474, -0.0482110791, -0.1408703178, -0.246330142, 0.0493122563, -0.175722912, 0.047348123, 0.1110769287, -0.0556812771, 0.290984422, 0.1304949522, 0.1616607606, -0.0623955205, -0.1468251497, 0.5156328082, 0.2943933308, -0.3300796449, 0.1609630883, 0.2148126066, -0.3500459194, -0.1941232532, 0.34138304, -0.2835558653, 0.0002673641, -0.2552974522, 0.0896735564, -0.0626334995, -0.1942969412, 0.0383377522, 0.5168799162, 0.5945782661, 0.0745409727, 0.3335528076, -0.5255038142, -0.2444201857, -0.2121092975, 0.0651088804, -0.0023092092, -0.4651452303, -0.0084926235, 0.2366490513, 0.1842956841, 0.3561902046, 0.4137145579, 0.0704918802, 0.1077741235, 0.0749111027, -0.0053550522, 0.4220858514, 0.1117162332, -0.2204667777, -0.0649490207, -0.05865575, 0.3635669947, -0.080704838, 0.0079565262, 0.3194954395, -0.2035728544, 0.2078324556, 0.0254101828, -0.2768172026, 0.0815220773, -0.2061397731, 0.0387926735, 0.4647623003, -0.0825524554, -0.0355013385, -0.0381801128, -0.3315751553, 0.3626122177, 0.2424905449, -0.1368881017, 0.0368464403, 0.0449778922, 0.0548132509, -0.0328166969, 0.0832959265, -0.0828898773, -0.5234783888, -0.0470568463, 0.0362096876, 0.2670902014, -0.0503190905, -0.1362541914, 0.2245898396, 0.0831877962, -0.0103790052, 0.0391421653, 0.0681505799, -0.171751827, -0.4256083965, 0.0723532289, -0.096664995, -0.2199120224, -0.0393040106, 0.1064347401, -0.4977487028, 0.0808113366, 0.0075054937, -0.196670264, -0.2570158243, 0.2851541042, 0.0231733527, -0.0891862512, -0.2323271334, 0.0862705857, 0.1931112707, -0.0923557654, -0.6234654784, 0.5602855682, 0.5223326683, 0.0226685517, 0.1969810724, 0.4178994298, 0.0167536922, 0.0668814704, -0.1525680721, 0.1664797515, 0.108337976, 0.0184075478, -0.2958196998, 0.0697328448, 0.2497303188, 0.176126644, -0.2609068155, -0.1829364002, -0.1405119002, -0.0761567578, -0.027982302, 0.1387431324, -0.412086755, 0.3359062672, 0.6934579611, -0.0322733931, 0.2642436028, 0.0308322143, -0.3138767779, -0.1533605307, 0.2285322994, -0.121576108, 0.2470547557, 0.0851404965, 0.3608530462, -0.1999172121, -0.1625252664, -0.0748270974, 0.2153989673, 0.0469215475, 0.066360496, 0.0049410686, 0.0751007944, 0.1541918069, -0.1057288423, 0.270960331, -0.050399214, 0.2032076865, -0.4259134829, 0.2171180844, -0.4016539156, 0.0512691885, -0.2296756506, -0.0917816535, -0.0777891427, -0.2456136942, -0.029358454, 0.0008401984, -0.2700946927, 0.3935127854, 0.261487782, 0.1166922301, 0.0873443782, -0.2350943983, -0.1146133393, -0.1724233478, -0.2385482937, 0.0400343835, 0.2083547562, -0.3795829415, 0.1849568784, 0.3574535549, -0.2676814795, -0.2696790695, -0.7421149015, 0.0485984981, -0.2355481535, 0.0960822403, 0.0381218642, 0.1293120533, -0.0246390738, 0.0510536842, 0.0254741982, 0.0944768637, -0.0181040298, 0.1180342361, -0.1916360706, 0.0291311108, -0.2872899771, -0.2801524401, -0.0367826261, -0.1219953895, 0.1812553108, -0.0798304155, -0.0676225722, 0.051486019, 0.0912295803, 0.0310504343, -0.0581302866, 0.2310896814, -0.4207526743, 0.0914393738, 0.3349054158, -0.1597367972, -0.3068856895, -0.1432786584, 0.0234636851, -0.0182585474, 0.0745136663, -0.2800923288, -0.0570337065, -0.2157624066, 0.2658352554, -0.0140342647, -0.1009147987, 0.5142833591, 0.2329594791, 0.0712706372, -0.0603919588, 0.0153216971, 0.0630326793, 0.2177912444, 0.2721603215, -0.0094197551, 0.3699365258, 0.1042172089, 0.358104676, 0.2943381369, -0.6948934793, -0.1260362267, -0.0573533475, 0.2153843343, -0.2174503505, -0.2911498845, 0.032002978, -0.2955262661, -0.1989387572, 0.0065345615, -0.2766372561, -0.27709198, 0.1184649467, 0.23312141, 0.1338420063, -0.4014646113, 0.4034070671, -0.3055262864, -0.0188107193, 0.0703194365, 0.1725527942, -0.1366493553, -0.1540072858, 0.1249558404, 0.0767138973, 0.139078021, -0.0452392176, -0.1560619026, -0.1616588086, -0.5573340058, 0.2960478961, 0.0733387917, 0.3998684883, -0.1019987166, -0.3138101399, -0.1236896515, 0.2658504844, 0.3583014011, -0.0651800483, -0.308555454, -0.0340752527, 0.0468398519, -0.1119084284, 0.0908224061, -0.3705393672, 0.1399976462, 0.1598603427, 0.4799209535, -0.3152982593, -0.1501233131, 0.3407088816, 0.099006094, -0.2651866376, 0.1257001609, -0.3059802949, -0.2172535956, 0.1029195487, -0.1605291069, 0.3218425214, -0.1130136028, -0.1629985273, -0.1421162337, -0.1887492388, -0.059386801, 0.3024403751, -0.0537966341, 0.1746543795, 0.2735583782, -0.0524261557, 0.1738077402, 0.4484736323, 0.0710391104, 0.3958068192, -0.2539946139, -0.4725270867, 0.1205895767, 0.2626000047, 0.2191856503, 0.3360379338, -0.0665045381, -0.010750385, 0.0495240651, 0.2013030201, -0.4152362645, 0.1450720429, 0.3002060652, 0.4395446181, -0.3818067312, -0.3916045427, 0.3398995697, 0.1049044877, -0.1118495911, 0.3452865183, -0.3406516612, -0.4210638106, 0.4126034677, 0.4866727591, 0.943916738, -0.0515247472, 0.362306416, 0.3886759877, 0.0395121686, 0.7027944922, -0.2195881456, 0.0953719318, -0.1092885211, -0.2003382295, -0.1821271628, 0.0283359047, 0.1922813207, -0.1768276989, -0.3934646249, -0.0114230281, 0.0450146757, 0.3950941563, 0.0918087438, 0.1370072663, 0.1337353289, -0.3839353919, 0.0010397994, 0.0962076858, -0.1420922279, -0.0245581381, 0.0258368067, -0.1296159476, -0.2271974832, -0.0388556048, -0.2351936102, -0.2038244754, -0.6721234322, 0.2279057205, -0.211289674, -0.3824327886, 0.2119165212, 0.3805317283, 0.4986091554, 0.0699414089, -0.1444130987, -0.0541000962, 0.1406934261, 0.2504909635, 0.3674526513, -0.3385371864, 0.5262501836, 0.1788808107, -0.0170451142, -0.0523226932, 0.0190298893, 0.1195789799, -0.3839369118, -0.0444363579, 0.0104463864, -0.4486306608, 0.0180259552, 0.0518194735, 0.1929471791, -0.0719196573, 0.0803572834, 0.0033200521, 0.0604199059, 0.4390887916, -0.2384053767, -0.2049400061, -0.1360177696, 0.2581451833, 0.3120487332, -0.0276792869, 0.3316818774, 0.174864769, -0.2199062258, -0.1326007247, 0.2696623504, 0.0962476879, -0.2718691826, 0.2938763201, -0.2294579893, -0.3275021315, -0.4029335082, 0.0242936797, 0.1296148896, 0.0200840458, -0.4275779426, 0.0481218994, -0.4269219637, 0.1955788732, 0.1994591206, 0.229496792, -0.0968035534, 0.2902585566, -0.1862213463, -0.075258106, -0.2788594961, -0.1454712451, 0.2015165836, 0.1607855707, -0.0480513461, -0.0622586682, 0.2153781354, -0.2433128357, 0.0800852329, 0.0955786183, 0.0832245201, -0.1688764095, -0.1338003278, 0.08440312, -0.0721535534, -0.1631307304, -0.0209845882, -0.1953464001, -0.1867279559, -0.1678043306, 0.1126664579, 0.2799354196, 0.1018422768, 0.2763631642, 0.0417337976, 0.1626679152, 0.3086151183, 0.0054952968, -0.1270997375, 0.2509422898, 0.0635593534, 0.3367978334, 0.0193026159, -0.0522143804, -0.1994489133, 0.2303502113, 0.0502554253, -0.0898419246, 0.4385260046, -0.186291486, -0.1380276829, 0.0113267563, 0.1839897335, 0.2505348921, -0.3121964633, -0.1436042935, -0.0271204785, 0.108014375, -0.184605509, 0.1011113524, 0.1920876652, -0.1086050123, 0.1267402768, 0.4136992395, -0.0296266843, 0.563444674, -0.0397621393, -0.0074643269, 0.1605864912, -0.2002459317, 0.2797860205, 0.2631993592, -0.0898273513, 0.1576703489, 0.2914582193, 0.079915382, 0.1357222646, 0.1433385015, 0.047520455, 0.2089090794, 0.0597947538, 0.0278487951, 0.4162572622, -0.1557867229, 0.1227425784, 0.090849556, -0.4397898614, 0.2601423264, 0.382668674, 0.0751200244, -0.3052259684, -0.235990718, -0.1305060834, 0.1503943354, -0.4149082601, 0.0025798257, -0.2539521456, 0.0859752968, -0.061961785, -0.2450639904, -0.2087458223, -0.047356341, 0.2073628157, 0.203363359, -0.1458739638, 0.0916261896, -0.2127765715, -0.1652699709, 0.0895996988, 0.0469893999, 0.3118063509, 0.3976687789, -0.1903302968, -0.164062649, 0.2795583904, 0.2608895898, 0.1900887042, -0.2551003695, 0.3188131452, 0.1368777454, -0.282248944, 0.0019032928, 0.2594350874, 0.0223128516, -0.018163031, 0.2152705789, 0.103710711, -0.0287231226, 0.1587680727, -0.0829134285, 0.2346435785, 0.0197712071, 0.6455356479, -0.0429135486, -0.1467238069, -0.0784747973, -0.20738554, -0.2123954594, -0.2224060744, 0.771080792, -0.1710175723, 0.2005573511, -0.0775001198, 0.0657909587, 0.2825327218, 0.3724640608, 0.0875460356, -0.0523023643, -0.218770504, 0.3671227098, -0.2781037688, 0.1055850387, 0.2141845077, -0.0478556007, -0.0218305662, 0.2236843854, 0.439227283, 0.2588708103, 0.0447613187, -0.4173417985, 0.2164111882, 0.0331134945, -0.1054256782, -0.2507252097, -0.4146490097, 0.1806096882, 0.0294063296, -0.349801898, 0.3316434622, 0.1330268532, -0.0241065975, -0.474532932, 0.0894953012, -0.0053972779, 0.2187123448, 0.2378495485, 0.4377464056, 0.1268992126, -0.129606396, -0.2555924952, 0.1482960135, -0.0524919853, -0.4803516269, 0.4116390646, -0.1601351053, 0.3657148182, -0.3011514544, -0.2907637954, -0.1951592863, 0.0258602612, 0.0851695091, -0.4364661276, -0.5503333211, 0.3894614577, -0.1322180629, -0.0845065489, 0.2017909735, 0.4802951515, 0.0986784175, 0.3818569779, -0.2019929439, -0.3419236839, 0.6405501366, -0.2690972686, -0.0412025563, -0.0623359419, -0.0725636035, -0.0648595169, 0.0509314537, -0.8520143628, -0.23993285, 0.2974299192, -0.2665517926, -0.2482234538, 0.309158653, 0.1196829006, 0.1341455579, -0.3145250976, 0.5315726995, -0.0456144363, -0.1521999985, 0.0940457582, -0.188225925 ]
https://github.com/huggingface/datasets/issues/625
dtype of tensors should be preserved
Reopening since @bhavitvyamalik started looking into it ! Also I'm posting here a function that could be helpful to support preserving the dtype of tensors. It's used to build a pyarrow array out of a numpy array and: - it doesn't convert the numpy array to a python list - it keeps the precision of the numpy array for the pyarrow array - it works with multidimensional arrays (while `pa.array` can only take a 1D array as input) - it builds the pyarrow ListArray from offsets created on-the-fly and values that come from the flattened numpy array ```python from functools import reduce from operator import mul import numpy as np import pyarrow as pa def pa_ndarray(a): """Build a PyArrow ListArray from a multidimensional NumPy array""" values = pa.array(a.flatten()) for i in range(a.ndim - 1): n_offsets = reduce(mul, a.shape[:a.ndim - i - 1], 1) step_offsets = a.shape[a.ndim - i - 1] offsets = pa.array(np.arange(n_offsets + 1) * step_offsets, type=pa.int32()) values = pa.ListArray.from_arrays(offsets, values) return values narr = np.arange(42).reshape(7, 2, 3).astype(np.uint8) parr = pa_ndarray(narr) assert isinstance(parr, pa.Array) assert parr.type == pa.list_(pa.list_(pa.uint8())) assert narr.tolist() == parr.to_pylist() ``` The only costly operation is the offsets computations. Since it doesn't iterate on the numpy array values this function is pretty fast.
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
206
dtype of tensors should be preserved After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. Reopening since @bhavitvyamalik started looking into it ! Also I'm posting here a function that could be helpful to support preserving the dtype of tensors. It's used to build a pyarrow array out of a numpy array and: - it doesn't convert the numpy array to a python list - it keeps the precision of the numpy array for the pyarrow array - it works with multidimensional arrays (while `pa.array` can only take a 1D array as input) - it builds the pyarrow ListArray from offsets created on-the-fly and values that come from the flattened numpy array ```python from functools import reduce from operator import mul import numpy as np import pyarrow as pa def pa_ndarray(a): """Build a PyArrow ListArray from a multidimensional NumPy array""" values = pa.array(a.flatten()) for i in range(a.ndim - 1): n_offsets = reduce(mul, a.shape[:a.ndim - i - 1], 1) step_offsets = a.shape[a.ndim - i - 1] offsets = pa.array(np.arange(n_offsets + 1) * step_offsets, type=pa.int32()) values = pa.ListArray.from_arrays(offsets, values) return values narr = np.arange(42).reshape(7, 2, 3).astype(np.uint8) parr = pa_ndarray(narr) assert isinstance(parr, pa.Array) assert parr.type == pa.list_(pa.list_(pa.uint8())) assert narr.tolist() == parr.to_pylist() ``` The only costly operation is the offsets computations. Since it doesn't iterate on the numpy array values this function is pretty fast.
[ -0.1134336665, -0.221115008, -0.0097108139, 0.2073050439, 0.5532283783, 0.1730132401, 0.5313699245, 0.1225807741, 0.1504824311, -0.0665397719, -0.0843991637, 0.2457148433, -0.117551893, -0.1751451641, 0.1026155949, -0.2025275528, 0.2282531559, -0.0652568489, -0.1441735029, -0.2050459683, -0.2274059653, -0.0888314694, -0.0027087252, -0.2082730085, -0.1601843834, -0.1640593857, 0.240316391, -0.1392812878, -0.185163781, -0.0010071729, 0.1801279187, -0.1652226001, 0.4167293906, 0.5717648268, -0.0001163156, 0.2217251658, -0.0266849883, -0.0754260495, -0.1886362731, -0.0001531355, 0.0046073291, -0.1931505948, -0.0723767504, -0.1798607111, -0.1541207731, -0.1833255589, -0.0845146552, -0.7935449481, 0.2889487147, 0.4108265638, 0.1519325376, 0.2570817769, 0.0712020621, 0.1525933743, -0.1351299435, 0.2725166082, -0.1030128226, 0.2802624106, -0.0208768621, 0.3604670167, -0.0614816993, 0.4459063411, -0.3614789546, -0.0750736743, 0.0291569643, 0.1127889976, 0.0541250817, -0.4639117718, -0.0662837625, 0.1654173583, 0.1973417401, -0.2320811003, -0.2843653858, -0.1672888547, -0.0933568701, -0.367162168, 0.0662379116, -0.0845818296, 0.1454868317, 0.1031548604, -0.0847082958, -0.1715695858, -0.0345696211, 0.1320960969, -0.4753401279, 0.2185825855, -0.0089361332, 0.1474191248, -0.1035435423, -0.0327193514, 0.074318178, -0.115951173, 0.2209848762, -0.0332038701, -0.1700054407, -0.223601684, 0.1068102717, -0.4505301416, -0.1278469265, -0.48186782, 0.2282643914, 0.1562224776, -0.2183921039, -0.0274901204, 0.210150376, 0.3317387402, -0.297642678, 0.3678761423, 0.2994465232, -0.0447377264, 0.2111327052, 0.0985191241, 0.1282293648, 0.046433866, -0.0115374792, 0.1037945673, 0.5391175747, -0.1061271951, -0.3156948388, 0.2423451692, -0.4640919268, 0.0854393989, 0.0290507134, 0.0762219205, -0.1580675989, 0.4469194114, 0.1909369379, 0.0856406093, -0.1537801474, -0.0482110791, -0.1408703178, -0.246330142, 0.0493122563, -0.175722912, 0.047348123, 0.1110769287, -0.0556812771, 0.290984422, 0.1304949522, 0.1616607606, -0.0623955205, -0.1468251497, 0.5156328082, 0.2943933308, -0.3300796449, 0.1609630883, 0.2148126066, -0.3500459194, -0.1941232532, 0.34138304, -0.2835558653, 0.0002673641, -0.2552974522, 0.0896735564, -0.0626334995, -0.1942969412, 0.0383377522, 0.5168799162, 0.5945782661, 0.0745409727, 0.3335528076, -0.5255038142, -0.2444201857, -0.2121092975, 0.0651088804, -0.0023092092, -0.4651452303, -0.0084926235, 0.2366490513, 0.1842956841, 0.3561902046, 0.4137145579, 0.0704918802, 0.1077741235, 0.0749111027, -0.0053550522, 0.4220858514, 0.1117162332, -0.2204667777, -0.0649490207, -0.05865575, 0.3635669947, -0.080704838, 0.0079565262, 0.3194954395, -0.2035728544, 0.2078324556, 0.0254101828, -0.2768172026, 0.0815220773, -0.2061397731, 0.0387926735, 0.4647623003, -0.0825524554, -0.0355013385, -0.0381801128, -0.3315751553, 0.3626122177, 0.2424905449, -0.1368881017, 0.0368464403, 0.0449778922, 0.0548132509, -0.0328166969, 0.0832959265, -0.0828898773, -0.5234783888, -0.0470568463, 0.0362096876, 0.2670902014, -0.0503190905, -0.1362541914, 0.2245898396, 0.0831877962, -0.0103790052, 0.0391421653, 0.0681505799, -0.171751827, -0.4256083965, 0.0723532289, -0.096664995, -0.2199120224, -0.0393040106, 0.1064347401, -0.4977487028, 0.0808113366, 0.0075054937, -0.196670264, -0.2570158243, 0.2851541042, 0.0231733527, -0.0891862512, -0.2323271334, 0.0862705857, 0.1931112707, -0.0923557654, -0.6234654784, 0.5602855682, 0.5223326683, 0.0226685517, 0.1969810724, 0.4178994298, 0.0167536922, 0.0668814704, -0.1525680721, 0.1664797515, 0.108337976, 0.0184075478, -0.2958196998, 0.0697328448, 0.2497303188, 0.176126644, -0.2609068155, -0.1829364002, -0.1405119002, -0.0761567578, -0.027982302, 0.1387431324, -0.412086755, 0.3359062672, 0.6934579611, -0.0322733931, 0.2642436028, 0.0308322143, -0.3138767779, -0.1533605307, 0.2285322994, -0.121576108, 0.2470547557, 0.0851404965, 0.3608530462, -0.1999172121, -0.1625252664, -0.0748270974, 0.2153989673, 0.0469215475, 0.066360496, 0.0049410686, 0.0751007944, 0.1541918069, -0.1057288423, 0.270960331, -0.050399214, 0.2032076865, -0.4259134829, 0.2171180844, -0.4016539156, 0.0512691885, -0.2296756506, -0.0917816535, -0.0777891427, -0.2456136942, -0.029358454, 0.0008401984, -0.2700946927, 0.3935127854, 0.261487782, 0.1166922301, 0.0873443782, -0.2350943983, -0.1146133393, -0.1724233478, -0.2385482937, 0.0400343835, 0.2083547562, -0.3795829415, 0.1849568784, 0.3574535549, -0.2676814795, -0.2696790695, -0.7421149015, 0.0485984981, -0.2355481535, 0.0960822403, 0.0381218642, 0.1293120533, -0.0246390738, 0.0510536842, 0.0254741982, 0.0944768637, -0.0181040298, 0.1180342361, -0.1916360706, 0.0291311108, -0.2872899771, -0.2801524401, -0.0367826261, -0.1219953895, 0.1812553108, -0.0798304155, -0.0676225722, 0.051486019, 0.0912295803, 0.0310504343, -0.0581302866, 0.2310896814, -0.4207526743, 0.0914393738, 0.3349054158, -0.1597367972, -0.3068856895, -0.1432786584, 0.0234636851, -0.0182585474, 0.0745136663, -0.2800923288, -0.0570337065, -0.2157624066, 0.2658352554, -0.0140342647, -0.1009147987, 0.5142833591, 0.2329594791, 0.0712706372, -0.0603919588, 0.0153216971, 0.0630326793, 0.2177912444, 0.2721603215, -0.0094197551, 0.3699365258, 0.1042172089, 0.358104676, 0.2943381369, -0.6948934793, -0.1260362267, -0.0573533475, 0.2153843343, -0.2174503505, -0.2911498845, 0.032002978, -0.2955262661, -0.1989387572, 0.0065345615, -0.2766372561, -0.27709198, 0.1184649467, 0.23312141, 0.1338420063, -0.4014646113, 0.4034070671, -0.3055262864, -0.0188107193, 0.0703194365, 0.1725527942, -0.1366493553, -0.1540072858, 0.1249558404, 0.0767138973, 0.139078021, -0.0452392176, -0.1560619026, -0.1616588086, -0.5573340058, 0.2960478961, 0.0733387917, 0.3998684883, -0.1019987166, -0.3138101399, -0.1236896515, 0.2658504844, 0.3583014011, -0.0651800483, -0.308555454, -0.0340752527, 0.0468398519, -0.1119084284, 0.0908224061, -0.3705393672, 0.1399976462, 0.1598603427, 0.4799209535, -0.3152982593, -0.1501233131, 0.3407088816, 0.099006094, -0.2651866376, 0.1257001609, -0.3059802949, -0.2172535956, 0.1029195487, -0.1605291069, 0.3218425214, -0.1130136028, -0.1629985273, -0.1421162337, -0.1887492388, -0.059386801, 0.3024403751, -0.0537966341, 0.1746543795, 0.2735583782, -0.0524261557, 0.1738077402, 0.4484736323, 0.0710391104, 0.3958068192, -0.2539946139, -0.4725270867, 0.1205895767, 0.2626000047, 0.2191856503, 0.3360379338, -0.0665045381, -0.010750385, 0.0495240651, 0.2013030201, -0.4152362645, 0.1450720429, 0.3002060652, 0.4395446181, -0.3818067312, -0.3916045427, 0.3398995697, 0.1049044877, -0.1118495911, 0.3452865183, -0.3406516612, -0.4210638106, 0.4126034677, 0.4866727591, 0.943916738, -0.0515247472, 0.362306416, 0.3886759877, 0.0395121686, 0.7027944922, -0.2195881456, 0.0953719318, -0.1092885211, -0.2003382295, -0.1821271628, 0.0283359047, 0.1922813207, -0.1768276989, -0.3934646249, -0.0114230281, 0.0450146757, 0.3950941563, 0.0918087438, 0.1370072663, 0.1337353289, -0.3839353919, 0.0010397994, 0.0962076858, -0.1420922279, -0.0245581381, 0.0258368067, -0.1296159476, -0.2271974832, -0.0388556048, -0.2351936102, -0.2038244754, -0.6721234322, 0.2279057205, -0.211289674, -0.3824327886, 0.2119165212, 0.3805317283, 0.4986091554, 0.0699414089, -0.1444130987, -0.0541000962, 0.1406934261, 0.2504909635, 0.3674526513, -0.3385371864, 0.5262501836, 0.1788808107, -0.0170451142, -0.0523226932, 0.0190298893, 0.1195789799, -0.3839369118, -0.0444363579, 0.0104463864, -0.4486306608, 0.0180259552, 0.0518194735, 0.1929471791, -0.0719196573, 0.0803572834, 0.0033200521, 0.0604199059, 0.4390887916, -0.2384053767, -0.2049400061, -0.1360177696, 0.2581451833, 0.3120487332, -0.0276792869, 0.3316818774, 0.174864769, -0.2199062258, -0.1326007247, 0.2696623504, 0.0962476879, -0.2718691826, 0.2938763201, -0.2294579893, -0.3275021315, -0.4029335082, 0.0242936797, 0.1296148896, 0.0200840458, -0.4275779426, 0.0481218994, -0.4269219637, 0.1955788732, 0.1994591206, 0.229496792, -0.0968035534, 0.2902585566, -0.1862213463, -0.075258106, -0.2788594961, -0.1454712451, 0.2015165836, 0.1607855707, -0.0480513461, -0.0622586682, 0.2153781354, -0.2433128357, 0.0800852329, 0.0955786183, 0.0832245201, -0.1688764095, -0.1338003278, 0.08440312, -0.0721535534, -0.1631307304, -0.0209845882, -0.1953464001, -0.1867279559, -0.1678043306, 0.1126664579, 0.2799354196, 0.1018422768, 0.2763631642, 0.0417337976, 0.1626679152, 0.3086151183, 0.0054952968, -0.1270997375, 0.2509422898, 0.0635593534, 0.3367978334, 0.0193026159, -0.0522143804, -0.1994489133, 0.2303502113, 0.0502554253, -0.0898419246, 0.4385260046, -0.186291486, -0.1380276829, 0.0113267563, 0.1839897335, 0.2505348921, -0.3121964633, -0.1436042935, -0.0271204785, 0.108014375, -0.184605509, 0.1011113524, 0.1920876652, -0.1086050123, 0.1267402768, 0.4136992395, -0.0296266843, 0.563444674, -0.0397621393, -0.0074643269, 0.1605864912, -0.2002459317, 0.2797860205, 0.2631993592, -0.0898273513, 0.1576703489, 0.2914582193, 0.079915382, 0.1357222646, 0.1433385015, 0.047520455, 0.2089090794, 0.0597947538, 0.0278487951, 0.4162572622, -0.1557867229, 0.1227425784, 0.090849556, -0.4397898614, 0.2601423264, 0.382668674, 0.0751200244, -0.3052259684, -0.235990718, -0.1305060834, 0.1503943354, -0.4149082601, 0.0025798257, -0.2539521456, 0.0859752968, -0.061961785, -0.2450639904, -0.2087458223, -0.047356341, 0.2073628157, 0.203363359, -0.1458739638, 0.0916261896, -0.2127765715, -0.1652699709, 0.0895996988, 0.0469893999, 0.3118063509, 0.3976687789, -0.1903302968, -0.164062649, 0.2795583904, 0.2608895898, 0.1900887042, -0.2551003695, 0.3188131452, 0.1368777454, -0.282248944, 0.0019032928, 0.2594350874, 0.0223128516, -0.018163031, 0.2152705789, 0.103710711, -0.0287231226, 0.1587680727, -0.0829134285, 0.2346435785, 0.0197712071, 0.6455356479, -0.0429135486, -0.1467238069, -0.0784747973, -0.20738554, -0.2123954594, -0.2224060744, 0.771080792, -0.1710175723, 0.2005573511, -0.0775001198, 0.0657909587, 0.2825327218, 0.3724640608, 0.0875460356, -0.0523023643, -0.218770504, 0.3671227098, -0.2781037688, 0.1055850387, 0.2141845077, -0.0478556007, -0.0218305662, 0.2236843854, 0.439227283, 0.2588708103, 0.0447613187, -0.4173417985, 0.2164111882, 0.0331134945, -0.1054256782, -0.2507252097, -0.4146490097, 0.1806096882, 0.0294063296, -0.349801898, 0.3316434622, 0.1330268532, -0.0241065975, -0.474532932, 0.0894953012, -0.0053972779, 0.2187123448, 0.2378495485, 0.4377464056, 0.1268992126, -0.129606396, -0.2555924952, 0.1482960135, -0.0524919853, -0.4803516269, 0.4116390646, -0.1601351053, 0.3657148182, -0.3011514544, -0.2907637954, -0.1951592863, 0.0258602612, 0.0851695091, -0.4364661276, -0.5503333211, 0.3894614577, -0.1322180629, -0.0845065489, 0.2017909735, 0.4802951515, 0.0986784175, 0.3818569779, -0.2019929439, -0.3419236839, 0.6405501366, -0.2690972686, -0.0412025563, -0.0623359419, -0.0725636035, -0.0648595169, 0.0509314537, -0.8520143628, -0.23993285, 0.2974299192, -0.2665517926, -0.2482234538, 0.309158653, 0.1196829006, 0.1341455579, -0.3145250976, 0.5315726995, -0.0456144363, -0.1521999985, 0.0940457582, -0.188225925 ]
https://github.com/huggingface/datasets/issues/625
dtype of tensors should be preserved
@lhoestq Have you thought about this further? We have a use case where we're attempting to load data containing numpy arrays using the `datasets` library. When using one of the "standard" methods (`[Value(...)]` or `Sequence()`) we see ~200 samples processed per second during the call to `_prepare_split`. This slowdown is caused by the vast number of calls to `encode_nested_example` (each sequence is converted to a list, and each element in the sequence...). Using the `Feature` `ArrayND` improves this somewhat to ~500/s as it now uses numpy's `tolist()` rather than iterating over each value in the array and converting them individually. However, it's still pretty slow and in theory it should be possible to avoid the `numpy -> python -> arrow` dance altogether. To demonstrate this, if you keep the `Feature` set to an `ArrayND` but instead return a `pa_ndarray(...)` in `_generate_examples` it skips the conversion (`return obj, False`) and hits ~11_000/s. Two orders of magnitude speed up! The problem is this then fails later on when the `ArrowWriter` tries to write the examples to disk :-( It would be nice to have first-class support for user-defined PyArrow objects. Is this a possibility? We have _large_ datasets where even an order of magnitude difference is important so settling on the middle ~500/s is less than ideal! Is there a workaround for this or another method that should be used instead that gets near-to or equal performance to returning PyArrow arrays?
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
239
dtype of tensors should be preserved After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. @lhoestq Have you thought about this further? We have a use case where we're attempting to load data containing numpy arrays using the `datasets` library. When using one of the "standard" methods (`[Value(...)]` or `Sequence()`) we see ~200 samples processed per second during the call to `_prepare_split`. This slowdown is caused by the vast number of calls to `encode_nested_example` (each sequence is converted to a list, and each element in the sequence...). Using the `Feature` `ArrayND` improves this somewhat to ~500/s as it now uses numpy's `tolist()` rather than iterating over each value in the array and converting them individually. However, it's still pretty slow and in theory it should be possible to avoid the `numpy -> python -> arrow` dance altogether. To demonstrate this, if you keep the `Feature` set to an `ArrayND` but instead return a `pa_ndarray(...)` in `_generate_examples` it skips the conversion (`return obj, False`) and hits ~11_000/s. Two orders of magnitude speed up! The problem is this then fails later on when the `ArrowWriter` tries to write the examples to disk :-( It would be nice to have first-class support for user-defined PyArrow objects. Is this a possibility? We have _large_ datasets where even an order of magnitude difference is important so settling on the middle ~500/s is less than ideal! Is there a workaround for this or another method that should be used instead that gets near-to or equal performance to returning PyArrow arrays?
[ -0.1134336665, -0.221115008, -0.0097108139, 0.2073050439, 0.5532283783, 0.1730132401, 0.5313699245, 0.1225807741, 0.1504824311, -0.0665397719, -0.0843991637, 0.2457148433, -0.117551893, -0.1751451641, 0.1026155949, -0.2025275528, 0.2282531559, -0.0652568489, -0.1441735029, -0.2050459683, -0.2274059653, -0.0888314694, -0.0027087252, -0.2082730085, -0.1601843834, -0.1640593857, 0.240316391, -0.1392812878, -0.185163781, -0.0010071729, 0.1801279187, -0.1652226001, 0.4167293906, 0.5717648268, -0.0001163156, 0.2217251658, -0.0266849883, -0.0754260495, -0.1886362731, -0.0001531355, 0.0046073291, -0.1931505948, -0.0723767504, -0.1798607111, -0.1541207731, -0.1833255589, -0.0845146552, -0.7935449481, 0.2889487147, 0.4108265638, 0.1519325376, 0.2570817769, 0.0712020621, 0.1525933743, -0.1351299435, 0.2725166082, -0.1030128226, 0.2802624106, -0.0208768621, 0.3604670167, -0.0614816993, 0.4459063411, -0.3614789546, -0.0750736743, 0.0291569643, 0.1127889976, 0.0541250817, -0.4639117718, -0.0662837625, 0.1654173583, 0.1973417401, -0.2320811003, -0.2843653858, -0.1672888547, -0.0933568701, -0.367162168, 0.0662379116, -0.0845818296, 0.1454868317, 0.1031548604, -0.0847082958, -0.1715695858, -0.0345696211, 0.1320960969, -0.4753401279, 0.2185825855, -0.0089361332, 0.1474191248, -0.1035435423, -0.0327193514, 0.074318178, -0.115951173, 0.2209848762, -0.0332038701, -0.1700054407, -0.223601684, 0.1068102717, -0.4505301416, -0.1278469265, -0.48186782, 0.2282643914, 0.1562224776, -0.2183921039, -0.0274901204, 0.210150376, 0.3317387402, -0.297642678, 0.3678761423, 0.2994465232, -0.0447377264, 0.2111327052, 0.0985191241, 0.1282293648, 0.046433866, -0.0115374792, 0.1037945673, 0.5391175747, -0.1061271951, -0.3156948388, 0.2423451692, -0.4640919268, 0.0854393989, 0.0290507134, 0.0762219205, -0.1580675989, 0.4469194114, 0.1909369379, 0.0856406093, -0.1537801474, -0.0482110791, -0.1408703178, -0.246330142, 0.0493122563, -0.175722912, 0.047348123, 0.1110769287, -0.0556812771, 0.290984422, 0.1304949522, 0.1616607606, -0.0623955205, -0.1468251497, 0.5156328082, 0.2943933308, -0.3300796449, 0.1609630883, 0.2148126066, -0.3500459194, -0.1941232532, 0.34138304, -0.2835558653, 0.0002673641, -0.2552974522, 0.0896735564, -0.0626334995, -0.1942969412, 0.0383377522, 0.5168799162, 0.5945782661, 0.0745409727, 0.3335528076, -0.5255038142, -0.2444201857, -0.2121092975, 0.0651088804, -0.0023092092, -0.4651452303, -0.0084926235, 0.2366490513, 0.1842956841, 0.3561902046, 0.4137145579, 0.0704918802, 0.1077741235, 0.0749111027, -0.0053550522, 0.4220858514, 0.1117162332, -0.2204667777, -0.0649490207, -0.05865575, 0.3635669947, -0.080704838, 0.0079565262, 0.3194954395, -0.2035728544, 0.2078324556, 0.0254101828, -0.2768172026, 0.0815220773, -0.2061397731, 0.0387926735, 0.4647623003, -0.0825524554, -0.0355013385, -0.0381801128, -0.3315751553, 0.3626122177, 0.2424905449, -0.1368881017, 0.0368464403, 0.0449778922, 0.0548132509, -0.0328166969, 0.0832959265, -0.0828898773, -0.5234783888, -0.0470568463, 0.0362096876, 0.2670902014, -0.0503190905, -0.1362541914, 0.2245898396, 0.0831877962, -0.0103790052, 0.0391421653, 0.0681505799, -0.171751827, -0.4256083965, 0.0723532289, -0.096664995, -0.2199120224, -0.0393040106, 0.1064347401, -0.4977487028, 0.0808113366, 0.0075054937, -0.196670264, -0.2570158243, 0.2851541042, 0.0231733527, -0.0891862512, -0.2323271334, 0.0862705857, 0.1931112707, -0.0923557654, -0.6234654784, 0.5602855682, 0.5223326683, 0.0226685517, 0.1969810724, 0.4178994298, 0.0167536922, 0.0668814704, -0.1525680721, 0.1664797515, 0.108337976, 0.0184075478, -0.2958196998, 0.0697328448, 0.2497303188, 0.176126644, -0.2609068155, -0.1829364002, -0.1405119002, -0.0761567578, -0.027982302, 0.1387431324, -0.412086755, 0.3359062672, 0.6934579611, -0.0322733931, 0.2642436028, 0.0308322143, -0.3138767779, -0.1533605307, 0.2285322994, -0.121576108, 0.2470547557, 0.0851404965, 0.3608530462, -0.1999172121, -0.1625252664, -0.0748270974, 0.2153989673, 0.0469215475, 0.066360496, 0.0049410686, 0.0751007944, 0.1541918069, -0.1057288423, 0.270960331, -0.050399214, 0.2032076865, -0.4259134829, 0.2171180844, -0.4016539156, 0.0512691885, -0.2296756506, -0.0917816535, -0.0777891427, -0.2456136942, -0.029358454, 0.0008401984, -0.2700946927, 0.3935127854, 0.261487782, 0.1166922301, 0.0873443782, -0.2350943983, -0.1146133393, -0.1724233478, -0.2385482937, 0.0400343835, 0.2083547562, -0.3795829415, 0.1849568784, 0.3574535549, -0.2676814795, -0.2696790695, -0.7421149015, 0.0485984981, -0.2355481535, 0.0960822403, 0.0381218642, 0.1293120533, -0.0246390738, 0.0510536842, 0.0254741982, 0.0944768637, -0.0181040298, 0.1180342361, -0.1916360706, 0.0291311108, -0.2872899771, -0.2801524401, -0.0367826261, -0.1219953895, 0.1812553108, -0.0798304155, -0.0676225722, 0.051486019, 0.0912295803, 0.0310504343, -0.0581302866, 0.2310896814, -0.4207526743, 0.0914393738, 0.3349054158, -0.1597367972, -0.3068856895, -0.1432786584, 0.0234636851, -0.0182585474, 0.0745136663, -0.2800923288, -0.0570337065, -0.2157624066, 0.2658352554, -0.0140342647, -0.1009147987, 0.5142833591, 0.2329594791, 0.0712706372, -0.0603919588, 0.0153216971, 0.0630326793, 0.2177912444, 0.2721603215, -0.0094197551, 0.3699365258, 0.1042172089, 0.358104676, 0.2943381369, -0.6948934793, -0.1260362267, -0.0573533475, 0.2153843343, -0.2174503505, -0.2911498845, 0.032002978, -0.2955262661, -0.1989387572, 0.0065345615, -0.2766372561, -0.27709198, 0.1184649467, 0.23312141, 0.1338420063, -0.4014646113, 0.4034070671, -0.3055262864, -0.0188107193, 0.0703194365, 0.1725527942, -0.1366493553, -0.1540072858, 0.1249558404, 0.0767138973, 0.139078021, -0.0452392176, -0.1560619026, -0.1616588086, -0.5573340058, 0.2960478961, 0.0733387917, 0.3998684883, -0.1019987166, -0.3138101399, -0.1236896515, 0.2658504844, 0.3583014011, -0.0651800483, -0.308555454, -0.0340752527, 0.0468398519, -0.1119084284, 0.0908224061, -0.3705393672, 0.1399976462, 0.1598603427, 0.4799209535, -0.3152982593, -0.1501233131, 0.3407088816, 0.099006094, -0.2651866376, 0.1257001609, -0.3059802949, -0.2172535956, 0.1029195487, -0.1605291069, 0.3218425214, -0.1130136028, -0.1629985273, -0.1421162337, -0.1887492388, -0.059386801, 0.3024403751, -0.0537966341, 0.1746543795, 0.2735583782, -0.0524261557, 0.1738077402, 0.4484736323, 0.0710391104, 0.3958068192, -0.2539946139, -0.4725270867, 0.1205895767, 0.2626000047, 0.2191856503, 0.3360379338, -0.0665045381, -0.010750385, 0.0495240651, 0.2013030201, -0.4152362645, 0.1450720429, 0.3002060652, 0.4395446181, -0.3818067312, -0.3916045427, 0.3398995697, 0.1049044877, -0.1118495911, 0.3452865183, -0.3406516612, -0.4210638106, 0.4126034677, 0.4866727591, 0.943916738, -0.0515247472, 0.362306416, 0.3886759877, 0.0395121686, 0.7027944922, -0.2195881456, 0.0953719318, -0.1092885211, -0.2003382295, -0.1821271628, 0.0283359047, 0.1922813207, -0.1768276989, -0.3934646249, -0.0114230281, 0.0450146757, 0.3950941563, 0.0918087438, 0.1370072663, 0.1337353289, -0.3839353919, 0.0010397994, 0.0962076858, -0.1420922279, -0.0245581381, 0.0258368067, -0.1296159476, -0.2271974832, -0.0388556048, -0.2351936102, -0.2038244754, -0.6721234322, 0.2279057205, -0.211289674, -0.3824327886, 0.2119165212, 0.3805317283, 0.4986091554, 0.0699414089, -0.1444130987, -0.0541000962, 0.1406934261, 0.2504909635, 0.3674526513, -0.3385371864, 0.5262501836, 0.1788808107, -0.0170451142, -0.0523226932, 0.0190298893, 0.1195789799, -0.3839369118, -0.0444363579, 0.0104463864, -0.4486306608, 0.0180259552, 0.0518194735, 0.1929471791, -0.0719196573, 0.0803572834, 0.0033200521, 0.0604199059, 0.4390887916, -0.2384053767, -0.2049400061, -0.1360177696, 0.2581451833, 0.3120487332, -0.0276792869, 0.3316818774, 0.174864769, -0.2199062258, -0.1326007247, 0.2696623504, 0.0962476879, -0.2718691826, 0.2938763201, -0.2294579893, -0.3275021315, -0.4029335082, 0.0242936797, 0.1296148896, 0.0200840458, -0.4275779426, 0.0481218994, -0.4269219637, 0.1955788732, 0.1994591206, 0.229496792, -0.0968035534, 0.2902585566, -0.1862213463, -0.075258106, -0.2788594961, -0.1454712451, 0.2015165836, 0.1607855707, -0.0480513461, -0.0622586682, 0.2153781354, -0.2433128357, 0.0800852329, 0.0955786183, 0.0832245201, -0.1688764095, -0.1338003278, 0.08440312, -0.0721535534, -0.1631307304, -0.0209845882, -0.1953464001, -0.1867279559, -0.1678043306, 0.1126664579, 0.2799354196, 0.1018422768, 0.2763631642, 0.0417337976, 0.1626679152, 0.3086151183, 0.0054952968, -0.1270997375, 0.2509422898, 0.0635593534, 0.3367978334, 0.0193026159, -0.0522143804, -0.1994489133, 0.2303502113, 0.0502554253, -0.0898419246, 0.4385260046, -0.186291486, -0.1380276829, 0.0113267563, 0.1839897335, 0.2505348921, -0.3121964633, -0.1436042935, -0.0271204785, 0.108014375, -0.184605509, 0.1011113524, 0.1920876652, -0.1086050123, 0.1267402768, 0.4136992395, -0.0296266843, 0.563444674, -0.0397621393, -0.0074643269, 0.1605864912, -0.2002459317, 0.2797860205, 0.2631993592, -0.0898273513, 0.1576703489, 0.2914582193, 0.079915382, 0.1357222646, 0.1433385015, 0.047520455, 0.2089090794, 0.0597947538, 0.0278487951, 0.4162572622, -0.1557867229, 0.1227425784, 0.090849556, -0.4397898614, 0.2601423264, 0.382668674, 0.0751200244, -0.3052259684, -0.235990718, -0.1305060834, 0.1503943354, -0.4149082601, 0.0025798257, -0.2539521456, 0.0859752968, -0.061961785, -0.2450639904, -0.2087458223, -0.047356341, 0.2073628157, 0.203363359, -0.1458739638, 0.0916261896, -0.2127765715, -0.1652699709, 0.0895996988, 0.0469893999, 0.3118063509, 0.3976687789, -0.1903302968, -0.164062649, 0.2795583904, 0.2608895898, 0.1900887042, -0.2551003695, 0.3188131452, 0.1368777454, -0.282248944, 0.0019032928, 0.2594350874, 0.0223128516, -0.018163031, 0.2152705789, 0.103710711, -0.0287231226, 0.1587680727, -0.0829134285, 0.2346435785, 0.0197712071, 0.6455356479, -0.0429135486, -0.1467238069, -0.0784747973, -0.20738554, -0.2123954594, -0.2224060744, 0.771080792, -0.1710175723, 0.2005573511, -0.0775001198, 0.0657909587, 0.2825327218, 0.3724640608, 0.0875460356, -0.0523023643, -0.218770504, 0.3671227098, -0.2781037688, 0.1055850387, 0.2141845077, -0.0478556007, -0.0218305662, 0.2236843854, 0.439227283, 0.2588708103, 0.0447613187, -0.4173417985, 0.2164111882, 0.0331134945, -0.1054256782, -0.2507252097, -0.4146490097, 0.1806096882, 0.0294063296, -0.349801898, 0.3316434622, 0.1330268532, -0.0241065975, -0.474532932, 0.0894953012, -0.0053972779, 0.2187123448, 0.2378495485, 0.4377464056, 0.1268992126, -0.129606396, -0.2555924952, 0.1482960135, -0.0524919853, -0.4803516269, 0.4116390646, -0.1601351053, 0.3657148182, -0.3011514544, -0.2907637954, -0.1951592863, 0.0258602612, 0.0851695091, -0.4364661276, -0.5503333211, 0.3894614577, -0.1322180629, -0.0845065489, 0.2017909735, 0.4802951515, 0.0986784175, 0.3818569779, -0.2019929439, -0.3419236839, 0.6405501366, -0.2690972686, -0.0412025563, -0.0623359419, -0.0725636035, -0.0648595169, 0.0509314537, -0.8520143628, -0.23993285, 0.2974299192, -0.2665517926, -0.2482234538, 0.309158653, 0.1196829006, 0.1341455579, -0.3145250976, 0.5315726995, -0.0456144363, -0.1521999985, 0.0940457582, -0.188225925 ]
https://github.com/huggingface/datasets/issues/625
dtype of tensors should be preserved
Hi ! It would be awesome to achieve this speed for numpy arrays ! For now we have to use `encode_nested_example` to convert numpy arrays to python lists since pyarrow doesn't support multidimensional numpy arrays (only 1D). Maybe let's start a new PR from your PR @bhavitvyamalik (idk why we didn't answer your PR at that time, sorry about that). Basically the idea is to allow `TypedSequence` to support numpy arrays as you did, and remove the numpy->python casting in `_cast_to_python_objects`. This is really important since we are starting to have a focus on other modalities than text as well (audio, images). Though until then @samgd, there is another feature that may interest you and that may give you the speed you want: In a dataset script you can subclass either a GeneratorBasedBuilder (with the `_generate_examples ` method) or an ArrowBasedBuilder if you want. the ArrowBasedBuilder allows to yield arrow data by implementing the `_generate_tables` method (it's the same as `_generate_examples` except you must yield arrow tables). Since the data are already in arrow format, it doesn't call `encode_nested_example`. Let me know if that helps.
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
185
dtype of tensors should be preserved After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)). As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this: ```python def preprocess(sentences: List[str]): token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences] sembeddings = stransformer.encode(sentences) print(sembeddings.dtype) return {"input_ids": token_ids, "sembedding": sembeddings} ``` Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32. It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case. My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64. ```python dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) ``` This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64. ```python import torch import numpy as np l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055] torch_tensor = torch.tensor(l) np_array = np.array(l) np_to_torch = torch.from_numpy(np_array) print(torch_tensor.dtype) # torch.float32 print(np_array.dtype) # float64 print(np_to_torch.dtype) # torch.float64 ``` This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision. The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. Hi ! It would be awesome to achieve this speed for numpy arrays ! For now we have to use `encode_nested_example` to convert numpy arrays to python lists since pyarrow doesn't support multidimensional numpy arrays (only 1D). Maybe let's start a new PR from your PR @bhavitvyamalik (idk why we didn't answer your PR at that time, sorry about that). Basically the idea is to allow `TypedSequence` to support numpy arrays as you did, and remove the numpy->python casting in `_cast_to_python_objects`. This is really important since we are starting to have a focus on other modalities than text as well (audio, images). Though until then @samgd, there is another feature that may interest you and that may give you the speed you want: In a dataset script you can subclass either a GeneratorBasedBuilder (with the `_generate_examples ` method) or an ArrowBasedBuilder if you want. the ArrowBasedBuilder allows to yield arrow data by implementing the `_generate_tables` method (it's the same as `_generate_examples` except you must yield arrow tables). Since the data are already in arrow format, it doesn't call `encode_nested_example`. Let me know if that helps.
[ -0.1134336665, -0.221115008, -0.0097108139, 0.2073050439, 0.5532283783, 0.1730132401, 0.5313699245, 0.1225807741, 0.1504824311, -0.0665397719, -0.0843991637, 0.2457148433, -0.117551893, -0.1751451641, 0.1026155949, -0.2025275528, 0.2282531559, -0.0652568489, -0.1441735029, -0.2050459683, -0.2274059653, -0.0888314694, -0.0027087252, -0.2082730085, -0.1601843834, -0.1640593857, 0.240316391, -0.1392812878, -0.185163781, -0.0010071729, 0.1801279187, -0.1652226001, 0.4167293906, 0.5717648268, -0.0001163156, 0.2217251658, -0.0266849883, -0.0754260495, -0.1886362731, -0.0001531355, 0.0046073291, -0.1931505948, -0.0723767504, -0.1798607111, -0.1541207731, -0.1833255589, -0.0845146552, -0.7935449481, 0.2889487147, 0.4108265638, 0.1519325376, 0.2570817769, 0.0712020621, 0.1525933743, -0.1351299435, 0.2725166082, -0.1030128226, 0.2802624106, -0.0208768621, 0.3604670167, -0.0614816993, 0.4459063411, -0.3614789546, -0.0750736743, 0.0291569643, 0.1127889976, 0.0541250817, -0.4639117718, -0.0662837625, 0.1654173583, 0.1973417401, -0.2320811003, -0.2843653858, -0.1672888547, -0.0933568701, -0.367162168, 0.0662379116, -0.0845818296, 0.1454868317, 0.1031548604, -0.0847082958, -0.1715695858, -0.0345696211, 0.1320960969, -0.4753401279, 0.2185825855, -0.0089361332, 0.1474191248, -0.1035435423, -0.0327193514, 0.074318178, -0.115951173, 0.2209848762, -0.0332038701, -0.1700054407, -0.223601684, 0.1068102717, -0.4505301416, -0.1278469265, -0.48186782, 0.2282643914, 0.1562224776, -0.2183921039, -0.0274901204, 0.210150376, 0.3317387402, -0.297642678, 0.3678761423, 0.2994465232, -0.0447377264, 0.2111327052, 0.0985191241, 0.1282293648, 0.046433866, -0.0115374792, 0.1037945673, 0.5391175747, -0.1061271951, -0.3156948388, 0.2423451692, -0.4640919268, 0.0854393989, 0.0290507134, 0.0762219205, -0.1580675989, 0.4469194114, 0.1909369379, 0.0856406093, -0.1537801474, -0.0482110791, -0.1408703178, -0.246330142, 0.0493122563, -0.175722912, 0.047348123, 0.1110769287, -0.0556812771, 0.290984422, 0.1304949522, 0.1616607606, -0.0623955205, -0.1468251497, 0.5156328082, 0.2943933308, -0.3300796449, 0.1609630883, 0.2148126066, -0.3500459194, -0.1941232532, 0.34138304, -0.2835558653, 0.0002673641, -0.2552974522, 0.0896735564, -0.0626334995, -0.1942969412, 0.0383377522, 0.5168799162, 0.5945782661, 0.0745409727, 0.3335528076, -0.5255038142, -0.2444201857, -0.2121092975, 0.0651088804, -0.0023092092, -0.4651452303, -0.0084926235, 0.2366490513, 0.1842956841, 0.3561902046, 0.4137145579, 0.0704918802, 0.1077741235, 0.0749111027, -0.0053550522, 0.4220858514, 0.1117162332, -0.2204667777, -0.0649490207, -0.05865575, 0.3635669947, -0.080704838, 0.0079565262, 0.3194954395, -0.2035728544, 0.2078324556, 0.0254101828, -0.2768172026, 0.0815220773, -0.2061397731, 0.0387926735, 0.4647623003, -0.0825524554, -0.0355013385, -0.0381801128, -0.3315751553, 0.3626122177, 0.2424905449, -0.1368881017, 0.0368464403, 0.0449778922, 0.0548132509, -0.0328166969, 0.0832959265, -0.0828898773, -0.5234783888, -0.0470568463, 0.0362096876, 0.2670902014, -0.0503190905, -0.1362541914, 0.2245898396, 0.0831877962, -0.0103790052, 0.0391421653, 0.0681505799, -0.171751827, -0.4256083965, 0.0723532289, -0.096664995, -0.2199120224, -0.0393040106, 0.1064347401, -0.4977487028, 0.0808113366, 0.0075054937, -0.196670264, -0.2570158243, 0.2851541042, 0.0231733527, -0.0891862512, -0.2323271334, 0.0862705857, 0.1931112707, -0.0923557654, -0.6234654784, 0.5602855682, 0.5223326683, 0.0226685517, 0.1969810724, 0.4178994298, 0.0167536922, 0.0668814704, -0.1525680721, 0.1664797515, 0.108337976, 0.0184075478, -0.2958196998, 0.0697328448, 0.2497303188, 0.176126644, -0.2609068155, -0.1829364002, -0.1405119002, -0.0761567578, -0.027982302, 0.1387431324, -0.412086755, 0.3359062672, 0.6934579611, -0.0322733931, 0.2642436028, 0.0308322143, -0.3138767779, -0.1533605307, 0.2285322994, -0.121576108, 0.2470547557, 0.0851404965, 0.3608530462, -0.1999172121, -0.1625252664, -0.0748270974, 0.2153989673, 0.0469215475, 0.066360496, 0.0049410686, 0.0751007944, 0.1541918069, -0.1057288423, 0.270960331, -0.050399214, 0.2032076865, -0.4259134829, 0.2171180844, -0.4016539156, 0.0512691885, -0.2296756506, -0.0917816535, -0.0777891427, -0.2456136942, -0.029358454, 0.0008401984, -0.2700946927, 0.3935127854, 0.261487782, 0.1166922301, 0.0873443782, -0.2350943983, -0.1146133393, -0.1724233478, -0.2385482937, 0.0400343835, 0.2083547562, -0.3795829415, 0.1849568784, 0.3574535549, -0.2676814795, -0.2696790695, -0.7421149015, 0.0485984981, -0.2355481535, 0.0960822403, 0.0381218642, 0.1293120533, -0.0246390738, 0.0510536842, 0.0254741982, 0.0944768637, -0.0181040298, 0.1180342361, -0.1916360706, 0.0291311108, -0.2872899771, -0.2801524401, -0.0367826261, -0.1219953895, 0.1812553108, -0.0798304155, -0.0676225722, 0.051486019, 0.0912295803, 0.0310504343, -0.0581302866, 0.2310896814, -0.4207526743, 0.0914393738, 0.3349054158, -0.1597367972, -0.3068856895, -0.1432786584, 0.0234636851, -0.0182585474, 0.0745136663, -0.2800923288, -0.0570337065, -0.2157624066, 0.2658352554, -0.0140342647, -0.1009147987, 0.5142833591, 0.2329594791, 0.0712706372, -0.0603919588, 0.0153216971, 0.0630326793, 0.2177912444, 0.2721603215, -0.0094197551, 0.3699365258, 0.1042172089, 0.358104676, 0.2943381369, -0.6948934793, -0.1260362267, -0.0573533475, 0.2153843343, -0.2174503505, -0.2911498845, 0.032002978, -0.2955262661, -0.1989387572, 0.0065345615, -0.2766372561, -0.27709198, 0.1184649467, 0.23312141, 0.1338420063, -0.4014646113, 0.4034070671, -0.3055262864, -0.0188107193, 0.0703194365, 0.1725527942, -0.1366493553, -0.1540072858, 0.1249558404, 0.0767138973, 0.139078021, -0.0452392176, -0.1560619026, -0.1616588086, -0.5573340058, 0.2960478961, 0.0733387917, 0.3998684883, -0.1019987166, -0.3138101399, -0.1236896515, 0.2658504844, 0.3583014011, -0.0651800483, -0.308555454, -0.0340752527, 0.0468398519, -0.1119084284, 0.0908224061, -0.3705393672, 0.1399976462, 0.1598603427, 0.4799209535, -0.3152982593, -0.1501233131, 0.3407088816, 0.099006094, -0.2651866376, 0.1257001609, -0.3059802949, -0.2172535956, 0.1029195487, -0.1605291069, 0.3218425214, -0.1130136028, -0.1629985273, -0.1421162337, -0.1887492388, -0.059386801, 0.3024403751, -0.0537966341, 0.1746543795, 0.2735583782, -0.0524261557, 0.1738077402, 0.4484736323, 0.0710391104, 0.3958068192, -0.2539946139, -0.4725270867, 0.1205895767, 0.2626000047, 0.2191856503, 0.3360379338, -0.0665045381, -0.010750385, 0.0495240651, 0.2013030201, -0.4152362645, 0.1450720429, 0.3002060652, 0.4395446181, -0.3818067312, -0.3916045427, 0.3398995697, 0.1049044877, -0.1118495911, 0.3452865183, -0.3406516612, -0.4210638106, 0.4126034677, 0.4866727591, 0.943916738, -0.0515247472, 0.362306416, 0.3886759877, 0.0395121686, 0.7027944922, -0.2195881456, 0.0953719318, -0.1092885211, -0.2003382295, -0.1821271628, 0.0283359047, 0.1922813207, -0.1768276989, -0.3934646249, -0.0114230281, 0.0450146757, 0.3950941563, 0.0918087438, 0.1370072663, 0.1337353289, -0.3839353919, 0.0010397994, 0.0962076858, -0.1420922279, -0.0245581381, 0.0258368067, -0.1296159476, -0.2271974832, -0.0388556048, -0.2351936102, -0.2038244754, -0.6721234322, 0.2279057205, -0.211289674, -0.3824327886, 0.2119165212, 0.3805317283, 0.4986091554, 0.0699414089, -0.1444130987, -0.0541000962, 0.1406934261, 0.2504909635, 0.3674526513, -0.3385371864, 0.5262501836, 0.1788808107, -0.0170451142, -0.0523226932, 0.0190298893, 0.1195789799, -0.3839369118, -0.0444363579, 0.0104463864, -0.4486306608, 0.0180259552, 0.0518194735, 0.1929471791, -0.0719196573, 0.0803572834, 0.0033200521, 0.0604199059, 0.4390887916, -0.2384053767, -0.2049400061, -0.1360177696, 0.2581451833, 0.3120487332, -0.0276792869, 0.3316818774, 0.174864769, -0.2199062258, -0.1326007247, 0.2696623504, 0.0962476879, -0.2718691826, 0.2938763201, -0.2294579893, -0.3275021315, -0.4029335082, 0.0242936797, 0.1296148896, 0.0200840458, -0.4275779426, 0.0481218994, -0.4269219637, 0.1955788732, 0.1994591206, 0.229496792, -0.0968035534, 0.2902585566, -0.1862213463, -0.075258106, -0.2788594961, -0.1454712451, 0.2015165836, 0.1607855707, -0.0480513461, -0.0622586682, 0.2153781354, -0.2433128357, 0.0800852329, 0.0955786183, 0.0832245201, -0.1688764095, -0.1338003278, 0.08440312, -0.0721535534, -0.1631307304, -0.0209845882, -0.1953464001, -0.1867279559, -0.1678043306, 0.1126664579, 0.2799354196, 0.1018422768, 0.2763631642, 0.0417337976, 0.1626679152, 0.3086151183, 0.0054952968, -0.1270997375, 0.2509422898, 0.0635593534, 0.3367978334, 0.0193026159, -0.0522143804, -0.1994489133, 0.2303502113, 0.0502554253, -0.0898419246, 0.4385260046, -0.186291486, -0.1380276829, 0.0113267563, 0.1839897335, 0.2505348921, -0.3121964633, -0.1436042935, -0.0271204785, 0.108014375, -0.184605509, 0.1011113524, 0.1920876652, -0.1086050123, 0.1267402768, 0.4136992395, -0.0296266843, 0.563444674, -0.0397621393, -0.0074643269, 0.1605864912, -0.2002459317, 0.2797860205, 0.2631993592, -0.0898273513, 0.1576703489, 0.2914582193, 0.079915382, 0.1357222646, 0.1433385015, 0.047520455, 0.2089090794, 0.0597947538, 0.0278487951, 0.4162572622, -0.1557867229, 0.1227425784, 0.090849556, -0.4397898614, 0.2601423264, 0.382668674, 0.0751200244, -0.3052259684, -0.235990718, -0.1305060834, 0.1503943354, -0.4149082601, 0.0025798257, -0.2539521456, 0.0859752968, -0.061961785, -0.2450639904, -0.2087458223, -0.047356341, 0.2073628157, 0.203363359, -0.1458739638, 0.0916261896, -0.2127765715, -0.1652699709, 0.0895996988, 0.0469893999, 0.3118063509, 0.3976687789, -0.1903302968, -0.164062649, 0.2795583904, 0.2608895898, 0.1900887042, -0.2551003695, 0.3188131452, 0.1368777454, -0.282248944, 0.0019032928, 0.2594350874, 0.0223128516, -0.018163031, 0.2152705789, 0.103710711, -0.0287231226, 0.1587680727, -0.0829134285, 0.2346435785, 0.0197712071, 0.6455356479, -0.0429135486, -0.1467238069, -0.0784747973, -0.20738554, -0.2123954594, -0.2224060744, 0.771080792, -0.1710175723, 0.2005573511, -0.0775001198, 0.0657909587, 0.2825327218, 0.3724640608, 0.0875460356, -0.0523023643, -0.218770504, 0.3671227098, -0.2781037688, 0.1055850387, 0.2141845077, -0.0478556007, -0.0218305662, 0.2236843854, 0.439227283, 0.2588708103, 0.0447613187, -0.4173417985, 0.2164111882, 0.0331134945, -0.1054256782, -0.2507252097, -0.4146490097, 0.1806096882, 0.0294063296, -0.349801898, 0.3316434622, 0.1330268532, -0.0241065975, -0.474532932, 0.0894953012, -0.0053972779, 0.2187123448, 0.2378495485, 0.4377464056, 0.1268992126, -0.129606396, -0.2555924952, 0.1482960135, -0.0524919853, -0.4803516269, 0.4116390646, -0.1601351053, 0.3657148182, -0.3011514544, -0.2907637954, -0.1951592863, 0.0258602612, 0.0851695091, -0.4364661276, -0.5503333211, 0.3894614577, -0.1322180629, -0.0845065489, 0.2017909735, 0.4802951515, 0.0986784175, 0.3818569779, -0.2019929439, -0.3419236839, 0.6405501366, -0.2690972686, -0.0412025563, -0.0623359419, -0.0725636035, -0.0648595169, 0.0509314537, -0.8520143628, -0.23993285, 0.2974299192, -0.2665517926, -0.2482234538, 0.309158653, 0.1196829006, 0.1341455579, -0.3145250976, 0.5315726995, -0.0456144363, -0.1521999985, 0.0940457582, -0.188225925 ]
https://github.com/huggingface/datasets/issues/623
Custom feature types in `load_dataset` from CSV
Currently `csv` doesn't support the `features` attribute (unlike `json`). What you can do for now is cast the features using the in-place transform `cast_` ```python from datasets import load_dataset dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label']) dataset.cast_(emotion_features) ```
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction.
38
Custom feature types in `load_dataset` from CSV I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction. Currently `csv` doesn't support the `features` attribute (unlike `json`). What you can do for now is cast the features using the in-place transform `cast_` ```python from datasets import load_dataset dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label']) dataset.cast_(emotion_features) ```
[ 0.0802028924, -0.2782892585, -0.0531790853, 0.3509229124, 0.3172289729, -0.1943105757, 0.5701336265, 0.1113842726, 0.446125567, 0.0253306851, 0.0947441235, 0.3161779642, -0.0919102132, 0.3901152909, -0.0581882037, 0.0267203413, -0.1612748355, 0.3348048329, -0.0091214385, -0.3497940302, -0.2713249922, 0.1799539477, -0.0930471718, -0.0134864599, -0.3072170615, 0.339589268, 0.2221690416, 0.1434387118, 0.0583123192, -0.3765772283, 0.4237109125, 0.1486944854, 0.3030694425, 0.0801389515, -0.0001151109, 0.0768829808, 0.0293593239, -0.1740054041, -0.0040853415, -0.3799197078, -0.038784463, -0.2029064894, 0.4247083366, -0.3651530743, -0.2385734171, -0.4564033449, -0.2810541391, -0.1292718649, 0.2869226038, 0.3292907774, 0.1512022316, -0.0502677187, -0.2750737965, 0.2184947878, 0.3587990701, 0.6755333543, -0.2523881793, 0.1870211363, -0.040634457, -0.1123655066, 0.0939734951, -0.1022862494, -0.1438640207, 0.3534233272, 0.4926103055, 0.171061635, -0.0643915236, -0.1303498, -0.173328042, 0.2814248204, 0.3474105, 0.0562937185, -0.0464357696, -0.3231964111, -0.1238630563, -0.2973287702, 0.3824171722, 0.084860377, -0.1818488538, 0.160442397, -0.0789407343, 0.4355743825, -0.0581504107, 0.325290978, 0.0186877474, -0.0715496317, -0.2392114103, 0.1055342034, 0.0308265928, -0.21731098, 0.0974366665, -0.3491620421, 0.2218384147, 0.1172009334, -0.0551005341, 0.0995840505, 0.0039352379, -0.0604649708, -0.1210800037, 0.0352325104, 0.2292757183, 0.1932828724, -0.1932465136, 0.0317142755, 0.2777895629, 0.244182542, 0.2002113461, -0.2317832112, 0.1527377069, 0.1047159582, -0.423279047, 0.0183333308, 0.0277892873, -0.3080181479, 0.3964600861, 0.0869554058, 0.5022858381, -0.2398284972, 0.0576626956, -0.098011978, 0.0428097956, -0.0321921073, 0.1175667867, 0.183557108, -0.0262655262, 0.5809873343, -0.0656144843, 0.1488877982, -0.3211800158, 0.1283436269, -0.0581270903, -0.2226471007, -0.0374677889, -0.0493202247, 0.403034538, 0.0941047147, 0.2478336245, 0.1990264207, -0.0237023886, -0.3186683953, -0.1270062774, -0.0959564075, 0.1245453134, 0.0443356298, -0.4416728914, 0.3375267088, 0.2412355989, -0.2255858779, -0.2444110513, 0.0952859521, -0.2509182394, -0.2328004688, 0.1970369965, 0.1555832624, -0.1784608364, -0.0209630895, -0.1068923473, 0.0988961756, 0.1280108541, 0.2582721114, 0.0263723116, -0.4864166975, -0.3809947371, -0.3249777853, -0.0254871044, 0.3954321742, -0.4154388607, -0.2039043754, 0.0394426323, -0.0463084169, 0.1385590732, 0.253090322, -0.3661012352, 0.1451613158, -0.2393055409, 0.2845744491, 0.5265448689, 0.0433981605, -0.2177200019, 0.4294439256, 0.1565903127, 0.3267547786, 0.1860678196, 0.0742608681, 0.0775936022, 0.1260917783, 0.159499824, 0.4206008613, 0.165720731, 0.0673818663, -0.18377693, -0.1553833932, 0.1656041145, -0.0030712972, -0.3288174272, 0.3090260327, 0.2257002294, -0.5133963823, 0.2171114683, -0.1282682419, -0.2264052182, -0.0468895957, 0.4030794203, 0.5202860236, 0.0057924916, -0.0192436595, -0.4824978709, 0.224633202, -0.1493486613, -0.0522527508, -0.0067958659, -0.3252949715, -0.493493557, -0.0567669384, -0.2471698523, 0.1995169371, 0.0646641627, 0.3136297166, -0.3358725905, 0.158852607, -0.0870927721, 0.0709816441, -0.2088876516, -0.25216344, -0.0801554844, -0.021776313, 0.1720781028, -0.0900507495, 0.01579234, 0.0775027573, 0.2781895399, 0.0767477602, -0.3883280158, 0.1277151853, 0.279560715, 0.1613470018, -0.1129956543, 0.2116078883, -0.0030282589, -0.009514099, -0.0278552249, 0.1732269377, 0.193562746, -0.0937049389, -0.0290853269, 0.6565467119, 0.1539307684, 0.2489784956, -0.2678476572, -0.1128535122, 0.2808353603, -0.0006698508, -0.1841067672, -0.0670059398, -0.2146352232, -0.048521243, 0.0014962169, 0.4216480851, -0.3299657106, -0.115778476, 0.478890866, 0.095458962, 0.1291624308, -0.080403693, -0.0172786433, -0.029092418, 0.0167227127, -0.2370506227, 0.4729242921, -0.061082568, -0.080364868, -0.0082822768, 0.0192123782, -0.2243367732, 0.0600000061, -0.1394983381, -0.1910201758, 0.2915715873, 0.0343267173, -0.1579159945, -0.3376891017, 0.2412528396, -0.1466076523, -0.2058870494, -0.634283483, -0.0990625322, -0.5823048949, 0.1683029234, -0.4637624919, -0.0822288096, -0.0697952658, 0.0163360965, -0.212019518, 0.1033788621, -0.0353965051, 0.0900430083, -0.1784477383, 0.3625628948, 0.0643080547, -0.8123736978, 0.2222117037, 0.1188195497, -0.4499815106, -0.0581740849, 0.174991563, 0.2886115611, 0.0355603211, 0.0289641507, -0.2870356739, 0.0080763334, -0.0132932961, -0.1399181932, 0.1707452834, 0.5402768254, 0.1732702106, 0.175692305, 0.1394032687, -0.1260673404, 0.398373872, -0.0131173255, 0.0591226555, -0.1250231266, -0.0263377354, 0.1114318445, -0.2428705692, -0.6793347597, -0.1501976699, -0.2003139704, 0.284424603, 0.213961944, 0.0511259139, 0.1971265674, 0.3683051765, -0.2396501601, 0.1546969116, -0.0263571627, -0.2073858976, -0.0725121871, 0.4438348711, -0.1748047769, -0.2186149061, 0.0093016028, -0.3093700707, -0.3122232556, 0.1340719014, -0.3119172156, 0.0612177253, -0.3492911458, 0.5237388015, 0.0541129336, 0.0240740888, 0.1082264259, -0.1130078882, 0.0396240726, -0.175863564, -0.3381879926, 0.4521702528, 0.3127172291, 0.0991489291, 0.4245265126, -0.025254583, -0.4129970968, 0.4985537827, -0.2855619788, -0.1919136345, 0.595359683, -0.1800898165, 0.1787188053, -0.0728686377, -0.2670248449, -0.1126027256, -0.0425650217, -0.1116567105, 0.2236915827, -0.0085568978, -0.270024538, -0.1810300201, 0.2123803496, -0.2176176012, -0.2608530521, 0.2379057109, 0.1473992616, -0.0105133532, -0.2122009844, -0.0562984981, -0.3047745228, -0.001116173, -0.0551237576, 0.4722040594, -0.1199500561, -0.0018577781, -0.3208263218, 0.2846592367, 0.0782867968, 0.1430099159, 0.2052049339, 0.0887331888, 0.0514348447, -0.2681928575, -0.0241439641, 0.1990230978, 0.2873642445, 0.0269078892, 0.1157548726, 0.2087190747, -0.1225695387, -0.0485271402, -0.3683555126, 0.1046844646, -0.098024264, -0.1456139833, 0.4273831546, -0.0174690131, -0.2047404349, 0.0689943209, 0.1473539621, -0.3237197101, -0.3246999383, -0.0766782239, -0.1038024649, 0.0663046166, -0.1572972536, 0.0566511713, 0.2637955844, -0.4567133486, -0.294929564, -0.3002609611, -0.0669391602, 0.4277198613, 0.0272209533, 0.3608856201, 0.0342605636, -0.1682981551, -0.0919504613, 0.3646994531, -0.2676112652, 0.5217869878, -0.0273078084, -0.3972114921, -0.1356139779, -0.2784287333, 0.1692487448, 0.2122792155, -0.3540076315, 0.0106411939, 0.0537485257, -0.1274202764, -0.3462888896, 0.4716669917, 0.4681009948, -0.1359973401, 0.170507893, -0.7704424262, 0.3951098025, -0.2586806715, -0.1935912073, -0.0233426243, -0.2719201446, -0.2325713784, 0.3815224767, 0.0811238512, 0.6033580303, -0.1063163877, 0.1100442857, 0.2331686765, 0.2517561316, 0.0767839924, 0.0193489678, -0.1155479178, -0.225033462, 0.104447186, -0.0204280075, -0.0284993909, 0.1987365633, 0.4217335582, 0.0612301044, 0.0763240755, -0.2039118558, 0.462703079, -0.1451128423, 0.1012346074, 0.0826516747, -0.2062902451, -0.1408654302, 0.0782317221, -0.0795416161, 0.2758698165, 0.0676955432, -0.1689652801, 0.0029450401, -0.2168520689, 0.0900495499, -0.1180126742, -0.3544567227, 0.1029872522, -0.0903589651, -0.1665311307, 0.049425263, 0.4377086759, 0.0453952514, 0.0724742115, 0.0026919448, -0.0892433301, 0.3455888629, 0.0723929554, -0.3652018309, 0.0003103189, 0.1250232309, 0.1094891131, -0.4165463448, -0.2229628414, 0.0246598665, -0.2354822457, -0.1175186783, -0.1140047461, -0.0075322008, -0.5912169218, -0.5814697146, -0.2086250782, 0.1575358659, 0.0230600964, 0.0865534917, -0.1536921263, 0.0544933639, 0.4086309373, 0.0256566536, -0.2936864793, -0.2414159328, 0.1097038239, 0.0934435576, -0.1074569076, 0.4937070906, -0.1585170627, 0.0675677583, -0.233401224, 0.1656763554, 0.0291344356, -0.2786065638, 0.1651808619, 0.2246357352, -0.2610380054, -0.1285683513, 0.6697030663, 0.0992184132, 0.3524081707, 0.0855975971, -0.3124062419, -0.3024980724, -0.1660955846, 0.1188771799, 0.3957428336, 0.0464487858, 0.1652832925, 0.141623348, -0.2059976459, -0.248338148, 0.0333892889, 0.115163967, 0.0171486139, 0.1608876735, 0.1793147624, 0.0733210593, 0.2779512107, 0.155892849, -0.0744744167, -0.0549421161, -0.1906138062, -0.2437295169, 0.1428410858, -0.1014105082, 0.2073238045, -0.1902384013, -0.2917288244, 0.1587089747, -0.2286085486, 0.1630495787, 0.2692561448, -0.0584337339, 0.5097594261, -0.1074662954, 0.2579499185, -0.0396137796, 0.3279566467, -0.183143124, 0.0911631808, 0.2839573324, -0.1068137363, -0.0950942561, 0.0866203532, -0.138792783, -0.2092009634, -0.2366230935, 0.3477985859, -0.0584279336, -0.1488166153, -0.0404732414, 0.2657980919, 0.1655935645, 0.4483642876, -0.0675903708, 0.0337993465, 0.1700199693, 0.2013855129, -0.137362048, 0.0610726327, 0.2482621521, 0.0578230061, 0.1259522587, 0.5288023949, 0.4163005948, -0.060954541, -0.1263368726, -0.2910685539, 0.1425028443, 0.1937830001, 0.1487295479, 0.3334578276, 0.0122656208, -0.0583517365, 0.0439712107, 0.1607936919, 0.1520166993, 0.3418110609, 0.02927812, -0.2028437555, 0.0008464457, 0.1873263121, 0.0220550299, -0.6729873419, 0.3362362683, 0.1451907009, -0.2824924588, 0.3987860978, 0.0277418867, 0.3040841818, -0.2217608839, -0.2226591855, -0.1894538105, 0.0515003428, -0.0737109482, -0.2347967178, -0.1169680506, -0.1961245239, -0.3086969852, -0.1200801358, 0.0403750166, 0.1298111528, 0.0409612283, 0.067796886, -0.057139691, -0.1646536887, 0.1864994019, -0.2584421337, 0.2858180404, 0.0312480219, 0.0454406366, -0.0801775157, 0.1768497825, 0.2635410428, -0.0922866687, -0.0588778891, 0.6529514194, -0.0708789527, -0.2127461135, -0.0827962384, 0.0492601097, -0.1479174644, -0.1888011545, -0.0592487641, 0.5324174762, 0.2739832699, 0.1294230521, -0.1248223484, 0.2267606854, -0.2451611012, 0.2631816268, -0.6641116738, 0.3068289161, 0.2461197823, 0.0778737515, -0.1524754018, 0.067432262, -0.1703534126, -0.1933409274, 0.4078930914, 0.3887723386, 0.5386597514, 0.0947168022, 0.0588995554, -0.2939715385, 0.2791741192, -0.2840402126, 0.0861396715, -0.0574958958, 0.2992790937, -0.7319203019, -0.0987627134, 0.2255545706, -0.1211580709, 0.1216319874, 0.2576981485, 0.0417751111, 0.11881008, -0.1557263732, -0.0532567985, 0.3186097443, 0.082505852, -0.1304461211, -0.2680416703, -0.1397156268, 0.181989938, 0.0978386998, -0.3734223247, -0.0446044989, 0.0930456445, 0.0255390778, -0.038303677, -0.2225392759, 0.0113507258, 0.0509980246, 0.2269795984, 0.0419546254, 0.1949174404, -0.0109647913, 0.1166931912, -0.2026651204, -0.0816120803, -0.1552952975, 0.0546444133, -0.2456045896, 0.5321159363, -0.3866824508, 0.5693585873, -0.4407522082, 0.1738171875, 0.2310235351, -0.4541363418, 0.0961408988, -0.0945511237, -0.1327077001, -0.1259730011, 0.0628546402, 0.3869295716, -0.1089816019, 0.1471087784, 0.1429866552, -0.3117976487, 0.3475707471, -0.0603822619, -0.2231803834, -0.0993921012, 0.224429816, 0.1183505505, 0.3281213939, -0.3093107343, -0.0371793881, 0.4952086806, -0.1033607647, 0.2260008007, 0.1840547323, -0.3150682151, 0.0563163161, -0.1813354343, 0.1425452828, 0.0503484085, 0.2422546148, -0.2390479445, -0.4779425263 ]
https://github.com/huggingface/datasets/issues/623
Custom feature types in `load_dataset` from CSV
Hi @lhoestq we've tried out your suggestion but are now running into the following error: ``` --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-163-81ffd5ac18c9> in <module> ----> 1 dataset.cast_(emotion_features) /usr/local/lib/python3.6/dist-packages/datasets/dataset_dict.py in cast_(self, features) 125 self._check_values_type() 126 for dataset in self.values(): --> 127 dataset.cast_(features=features) 128 129 def remove_columns_(self, column_names: Union[str, List[str]]): /usr/local/lib/python3.6/dist-packages/datasets/fingerprint.py in wrapper(*args, **kwargs) 161 # Call actual function 162 --> 163 out = func(self, *args, **kwargs) 164 165 # Update fingerprint of in-place transforms + update in-place history of transforms /usr/local/lib/python3.6/dist-packages/datasets/arrow_dataset.py in cast_(self, features) 602 self._info.features = features 603 schema = pa.schema(features.type) --> 604 self._data = self._data.cast(schema) 605 606 @fingerprint(inplace=True) /usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast() ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text'] ``` Looking at the types in `emotion_features` we see that `label` and `text` appear to be swapped in the Arrow table: ``` emotion_features.type StructType(struct<label: int64, text: string>) ``` Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction.
168
Custom feature types in `load_dataset` from CSV I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction. Hi @lhoestq we've tried out your suggestion but are now running into the following error: ``` --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-163-81ffd5ac18c9> in <module> ----> 1 dataset.cast_(emotion_features) /usr/local/lib/python3.6/dist-packages/datasets/dataset_dict.py in cast_(self, features) 125 self._check_values_type() 126 for dataset in self.values(): --> 127 dataset.cast_(features=features) 128 129 def remove_columns_(self, column_names: Union[str, List[str]]): /usr/local/lib/python3.6/dist-packages/datasets/fingerprint.py in wrapper(*args, **kwargs) 161 # Call actual function 162 --> 163 out = func(self, *args, **kwargs) 164 165 # Update fingerprint of in-place transforms + update in-place history of transforms /usr/local/lib/python3.6/dist-packages/datasets/arrow_dataset.py in cast_(self, features) 602 self._info.features = features 603 schema = pa.schema(features.type) --> 604 self._data = self._data.cast(schema) 605 606 @fingerprint(inplace=True) /usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast() ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text'] ``` Looking at the types in `emotion_features` we see that `label` and `text` appear to be swapped in the Arrow table: ``` emotion_features.type StructType(struct<label: int64, text: string>) ``` Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬
[ 0.0802028924, -0.2782892585, -0.0531790853, 0.3509229124, 0.3172289729, -0.1943105757, 0.5701336265, 0.1113842726, 0.446125567, 0.0253306851, 0.0947441235, 0.3161779642, -0.0919102132, 0.3901152909, -0.0581882037, 0.0267203413, -0.1612748355, 0.3348048329, -0.0091214385, -0.3497940302, -0.2713249922, 0.1799539477, -0.0930471718, -0.0134864599, -0.3072170615, 0.339589268, 0.2221690416, 0.1434387118, 0.0583123192, -0.3765772283, 0.4237109125, 0.1486944854, 0.3030694425, 0.0801389515, -0.0001151109, 0.0768829808, 0.0293593239, -0.1740054041, -0.0040853415, -0.3799197078, -0.038784463, -0.2029064894, 0.4247083366, -0.3651530743, -0.2385734171, -0.4564033449, -0.2810541391, -0.1292718649, 0.2869226038, 0.3292907774, 0.1512022316, -0.0502677187, -0.2750737965, 0.2184947878, 0.3587990701, 0.6755333543, -0.2523881793, 0.1870211363, -0.040634457, -0.1123655066, 0.0939734951, -0.1022862494, -0.1438640207, 0.3534233272, 0.4926103055, 0.171061635, -0.0643915236, -0.1303498, -0.173328042, 0.2814248204, 0.3474105, 0.0562937185, -0.0464357696, -0.3231964111, -0.1238630563, -0.2973287702, 0.3824171722, 0.084860377, -0.1818488538, 0.160442397, -0.0789407343, 0.4355743825, -0.0581504107, 0.325290978, 0.0186877474, -0.0715496317, -0.2392114103, 0.1055342034, 0.0308265928, -0.21731098, 0.0974366665, -0.3491620421, 0.2218384147, 0.1172009334, -0.0551005341, 0.0995840505, 0.0039352379, -0.0604649708, -0.1210800037, 0.0352325104, 0.2292757183, 0.1932828724, -0.1932465136, 0.0317142755, 0.2777895629, 0.244182542, 0.2002113461, -0.2317832112, 0.1527377069, 0.1047159582, -0.423279047, 0.0183333308, 0.0277892873, -0.3080181479, 0.3964600861, 0.0869554058, 0.5022858381, -0.2398284972, 0.0576626956, -0.098011978, 0.0428097956, -0.0321921073, 0.1175667867, 0.183557108, -0.0262655262, 0.5809873343, -0.0656144843, 0.1488877982, -0.3211800158, 0.1283436269, -0.0581270903, -0.2226471007, -0.0374677889, -0.0493202247, 0.403034538, 0.0941047147, 0.2478336245, 0.1990264207, -0.0237023886, -0.3186683953, -0.1270062774, -0.0959564075, 0.1245453134, 0.0443356298, -0.4416728914, 0.3375267088, 0.2412355989, -0.2255858779, -0.2444110513, 0.0952859521, -0.2509182394, -0.2328004688, 0.1970369965, 0.1555832624, -0.1784608364, -0.0209630895, -0.1068923473, 0.0988961756, 0.1280108541, 0.2582721114, 0.0263723116, -0.4864166975, -0.3809947371, -0.3249777853, -0.0254871044, 0.3954321742, -0.4154388607, -0.2039043754, 0.0394426323, -0.0463084169, 0.1385590732, 0.253090322, -0.3661012352, 0.1451613158, -0.2393055409, 0.2845744491, 0.5265448689, 0.0433981605, -0.2177200019, 0.4294439256, 0.1565903127, 0.3267547786, 0.1860678196, 0.0742608681, 0.0775936022, 0.1260917783, 0.159499824, 0.4206008613, 0.165720731, 0.0673818663, -0.18377693, -0.1553833932, 0.1656041145, -0.0030712972, -0.3288174272, 0.3090260327, 0.2257002294, -0.5133963823, 0.2171114683, -0.1282682419, -0.2264052182, -0.0468895957, 0.4030794203, 0.5202860236, 0.0057924916, -0.0192436595, -0.4824978709, 0.224633202, -0.1493486613, -0.0522527508, -0.0067958659, -0.3252949715, -0.493493557, -0.0567669384, -0.2471698523, 0.1995169371, 0.0646641627, 0.3136297166, -0.3358725905, 0.158852607, -0.0870927721, 0.0709816441, -0.2088876516, -0.25216344, -0.0801554844, -0.021776313, 0.1720781028, -0.0900507495, 0.01579234, 0.0775027573, 0.2781895399, 0.0767477602, -0.3883280158, 0.1277151853, 0.279560715, 0.1613470018, -0.1129956543, 0.2116078883, -0.0030282589, -0.009514099, -0.0278552249, 0.1732269377, 0.193562746, -0.0937049389, -0.0290853269, 0.6565467119, 0.1539307684, 0.2489784956, -0.2678476572, -0.1128535122, 0.2808353603, -0.0006698508, -0.1841067672, -0.0670059398, -0.2146352232, -0.048521243, 0.0014962169, 0.4216480851, -0.3299657106, -0.115778476, 0.478890866, 0.095458962, 0.1291624308, -0.080403693, -0.0172786433, -0.029092418, 0.0167227127, -0.2370506227, 0.4729242921, -0.061082568, -0.080364868, -0.0082822768, 0.0192123782, -0.2243367732, 0.0600000061, -0.1394983381, -0.1910201758, 0.2915715873, 0.0343267173, -0.1579159945, -0.3376891017, 0.2412528396, -0.1466076523, -0.2058870494, -0.634283483, -0.0990625322, -0.5823048949, 0.1683029234, -0.4637624919, -0.0822288096, -0.0697952658, 0.0163360965, -0.212019518, 0.1033788621, -0.0353965051, 0.0900430083, -0.1784477383, 0.3625628948, 0.0643080547, -0.8123736978, 0.2222117037, 0.1188195497, -0.4499815106, -0.0581740849, 0.174991563, 0.2886115611, 0.0355603211, 0.0289641507, -0.2870356739, 0.0080763334, -0.0132932961, -0.1399181932, 0.1707452834, 0.5402768254, 0.1732702106, 0.175692305, 0.1394032687, -0.1260673404, 0.398373872, -0.0131173255, 0.0591226555, -0.1250231266, -0.0263377354, 0.1114318445, -0.2428705692, -0.6793347597, -0.1501976699, -0.2003139704, 0.284424603, 0.213961944, 0.0511259139, 0.1971265674, 0.3683051765, -0.2396501601, 0.1546969116, -0.0263571627, -0.2073858976, -0.0725121871, 0.4438348711, -0.1748047769, -0.2186149061, 0.0093016028, -0.3093700707, -0.3122232556, 0.1340719014, -0.3119172156, 0.0612177253, -0.3492911458, 0.5237388015, 0.0541129336, 0.0240740888, 0.1082264259, -0.1130078882, 0.0396240726, -0.175863564, -0.3381879926, 0.4521702528, 0.3127172291, 0.0991489291, 0.4245265126, -0.025254583, -0.4129970968, 0.4985537827, -0.2855619788, -0.1919136345, 0.595359683, -0.1800898165, 0.1787188053, -0.0728686377, -0.2670248449, -0.1126027256, -0.0425650217, -0.1116567105, 0.2236915827, -0.0085568978, -0.270024538, -0.1810300201, 0.2123803496, -0.2176176012, -0.2608530521, 0.2379057109, 0.1473992616, -0.0105133532, -0.2122009844, -0.0562984981, -0.3047745228, -0.001116173, -0.0551237576, 0.4722040594, -0.1199500561, -0.0018577781, -0.3208263218, 0.2846592367, 0.0782867968, 0.1430099159, 0.2052049339, 0.0887331888, 0.0514348447, -0.2681928575, -0.0241439641, 0.1990230978, 0.2873642445, 0.0269078892, 0.1157548726, 0.2087190747, -0.1225695387, -0.0485271402, -0.3683555126, 0.1046844646, -0.098024264, -0.1456139833, 0.4273831546, -0.0174690131, -0.2047404349, 0.0689943209, 0.1473539621, -0.3237197101, -0.3246999383, -0.0766782239, -0.1038024649, 0.0663046166, -0.1572972536, 0.0566511713, 0.2637955844, -0.4567133486, -0.294929564, -0.3002609611, -0.0669391602, 0.4277198613, 0.0272209533, 0.3608856201, 0.0342605636, -0.1682981551, -0.0919504613, 0.3646994531, -0.2676112652, 0.5217869878, -0.0273078084, -0.3972114921, -0.1356139779, -0.2784287333, 0.1692487448, 0.2122792155, -0.3540076315, 0.0106411939, 0.0537485257, -0.1274202764, -0.3462888896, 0.4716669917, 0.4681009948, -0.1359973401, 0.170507893, -0.7704424262, 0.3951098025, -0.2586806715, -0.1935912073, -0.0233426243, -0.2719201446, -0.2325713784, 0.3815224767, 0.0811238512, 0.6033580303, -0.1063163877, 0.1100442857, 0.2331686765, 0.2517561316, 0.0767839924, 0.0193489678, -0.1155479178, -0.225033462, 0.104447186, -0.0204280075, -0.0284993909, 0.1987365633, 0.4217335582, 0.0612301044, 0.0763240755, -0.2039118558, 0.462703079, -0.1451128423, 0.1012346074, 0.0826516747, -0.2062902451, -0.1408654302, 0.0782317221, -0.0795416161, 0.2758698165, 0.0676955432, -0.1689652801, 0.0029450401, -0.2168520689, 0.0900495499, -0.1180126742, -0.3544567227, 0.1029872522, -0.0903589651, -0.1665311307, 0.049425263, 0.4377086759, 0.0453952514, 0.0724742115, 0.0026919448, -0.0892433301, 0.3455888629, 0.0723929554, -0.3652018309, 0.0003103189, 0.1250232309, 0.1094891131, -0.4165463448, -0.2229628414, 0.0246598665, -0.2354822457, -0.1175186783, -0.1140047461, -0.0075322008, -0.5912169218, -0.5814697146, -0.2086250782, 0.1575358659, 0.0230600964, 0.0865534917, -0.1536921263, 0.0544933639, 0.4086309373, 0.0256566536, -0.2936864793, -0.2414159328, 0.1097038239, 0.0934435576, -0.1074569076, 0.4937070906, -0.1585170627, 0.0675677583, -0.233401224, 0.1656763554, 0.0291344356, -0.2786065638, 0.1651808619, 0.2246357352, -0.2610380054, -0.1285683513, 0.6697030663, 0.0992184132, 0.3524081707, 0.0855975971, -0.3124062419, -0.3024980724, -0.1660955846, 0.1188771799, 0.3957428336, 0.0464487858, 0.1652832925, 0.141623348, -0.2059976459, -0.248338148, 0.0333892889, 0.115163967, 0.0171486139, 0.1608876735, 0.1793147624, 0.0733210593, 0.2779512107, 0.155892849, -0.0744744167, -0.0549421161, -0.1906138062, -0.2437295169, 0.1428410858, -0.1014105082, 0.2073238045, -0.1902384013, -0.2917288244, 0.1587089747, -0.2286085486, 0.1630495787, 0.2692561448, -0.0584337339, 0.5097594261, -0.1074662954, 0.2579499185, -0.0396137796, 0.3279566467, -0.183143124, 0.0911631808, 0.2839573324, -0.1068137363, -0.0950942561, 0.0866203532, -0.138792783, -0.2092009634, -0.2366230935, 0.3477985859, -0.0584279336, -0.1488166153, -0.0404732414, 0.2657980919, 0.1655935645, 0.4483642876, -0.0675903708, 0.0337993465, 0.1700199693, 0.2013855129, -0.137362048, 0.0610726327, 0.2482621521, 0.0578230061, 0.1259522587, 0.5288023949, 0.4163005948, -0.060954541, -0.1263368726, -0.2910685539, 0.1425028443, 0.1937830001, 0.1487295479, 0.3334578276, 0.0122656208, -0.0583517365, 0.0439712107, 0.1607936919, 0.1520166993, 0.3418110609, 0.02927812, -0.2028437555, 0.0008464457, 0.1873263121, 0.0220550299, -0.6729873419, 0.3362362683, 0.1451907009, -0.2824924588, 0.3987860978, 0.0277418867, 0.3040841818, -0.2217608839, -0.2226591855, -0.1894538105, 0.0515003428, -0.0737109482, -0.2347967178, -0.1169680506, -0.1961245239, -0.3086969852, -0.1200801358, 0.0403750166, 0.1298111528, 0.0409612283, 0.067796886, -0.057139691, -0.1646536887, 0.1864994019, -0.2584421337, 0.2858180404, 0.0312480219, 0.0454406366, -0.0801775157, 0.1768497825, 0.2635410428, -0.0922866687, -0.0588778891, 0.6529514194, -0.0708789527, -0.2127461135, -0.0827962384, 0.0492601097, -0.1479174644, -0.1888011545, -0.0592487641, 0.5324174762, 0.2739832699, 0.1294230521, -0.1248223484, 0.2267606854, -0.2451611012, 0.2631816268, -0.6641116738, 0.3068289161, 0.2461197823, 0.0778737515, -0.1524754018, 0.067432262, -0.1703534126, -0.1933409274, 0.4078930914, 0.3887723386, 0.5386597514, 0.0947168022, 0.0588995554, -0.2939715385, 0.2791741192, -0.2840402126, 0.0861396715, -0.0574958958, 0.2992790937, -0.7319203019, -0.0987627134, 0.2255545706, -0.1211580709, 0.1216319874, 0.2576981485, 0.0417751111, 0.11881008, -0.1557263732, -0.0532567985, 0.3186097443, 0.082505852, -0.1304461211, -0.2680416703, -0.1397156268, 0.181989938, 0.0978386998, -0.3734223247, -0.0446044989, 0.0930456445, 0.0255390778, -0.038303677, -0.2225392759, 0.0113507258, 0.0509980246, 0.2269795984, 0.0419546254, 0.1949174404, -0.0109647913, 0.1166931912, -0.2026651204, -0.0816120803, -0.1552952975, 0.0546444133, -0.2456045896, 0.5321159363, -0.3866824508, 0.5693585873, -0.4407522082, 0.1738171875, 0.2310235351, -0.4541363418, 0.0961408988, -0.0945511237, -0.1327077001, -0.1259730011, 0.0628546402, 0.3869295716, -0.1089816019, 0.1471087784, 0.1429866552, -0.3117976487, 0.3475707471, -0.0603822619, -0.2231803834, -0.0993921012, 0.224429816, 0.1183505505, 0.3281213939, -0.3093107343, -0.0371793881, 0.4952086806, -0.1033607647, 0.2260008007, 0.1840547323, -0.3150682151, 0.0563163161, -0.1813354343, 0.1425452828, 0.0503484085, 0.2422546148, -0.2390479445, -0.4779425263 ]
https://github.com/huggingface/datasets/issues/623
Custom feature types in `load_dataset` from CSV
In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq? Should I add it?
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction.
26
Custom feature types in `load_dataset` from CSV I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction. In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq? Should I add it?
[ 0.0802028924, -0.2782892585, -0.0531790853, 0.3509229124, 0.3172289729, -0.1943105757, 0.5701336265, 0.1113842726, 0.446125567, 0.0253306851, 0.0947441235, 0.3161779642, -0.0919102132, 0.3901152909, -0.0581882037, 0.0267203413, -0.1612748355, 0.3348048329, -0.0091214385, -0.3497940302, -0.2713249922, 0.1799539477, -0.0930471718, -0.0134864599, -0.3072170615, 0.339589268, 0.2221690416, 0.1434387118, 0.0583123192, -0.3765772283, 0.4237109125, 0.1486944854, 0.3030694425, 0.0801389515, -0.0001151109, 0.0768829808, 0.0293593239, -0.1740054041, -0.0040853415, -0.3799197078, -0.038784463, -0.2029064894, 0.4247083366, -0.3651530743, -0.2385734171, -0.4564033449, -0.2810541391, -0.1292718649, 0.2869226038, 0.3292907774, 0.1512022316, -0.0502677187, -0.2750737965, 0.2184947878, 0.3587990701, 0.6755333543, -0.2523881793, 0.1870211363, -0.040634457, -0.1123655066, 0.0939734951, -0.1022862494, -0.1438640207, 0.3534233272, 0.4926103055, 0.171061635, -0.0643915236, -0.1303498, -0.173328042, 0.2814248204, 0.3474105, 0.0562937185, -0.0464357696, -0.3231964111, -0.1238630563, -0.2973287702, 0.3824171722, 0.084860377, -0.1818488538, 0.160442397, -0.0789407343, 0.4355743825, -0.0581504107, 0.325290978, 0.0186877474, -0.0715496317, -0.2392114103, 0.1055342034, 0.0308265928, -0.21731098, 0.0974366665, -0.3491620421, 0.2218384147, 0.1172009334, -0.0551005341, 0.0995840505, 0.0039352379, -0.0604649708, -0.1210800037, 0.0352325104, 0.2292757183, 0.1932828724, -0.1932465136, 0.0317142755, 0.2777895629, 0.244182542, 0.2002113461, -0.2317832112, 0.1527377069, 0.1047159582, -0.423279047, 0.0183333308, 0.0277892873, -0.3080181479, 0.3964600861, 0.0869554058, 0.5022858381, -0.2398284972, 0.0576626956, -0.098011978, 0.0428097956, -0.0321921073, 0.1175667867, 0.183557108, -0.0262655262, 0.5809873343, -0.0656144843, 0.1488877982, -0.3211800158, 0.1283436269, -0.0581270903, -0.2226471007, -0.0374677889, -0.0493202247, 0.403034538, 0.0941047147, 0.2478336245, 0.1990264207, -0.0237023886, -0.3186683953, -0.1270062774, -0.0959564075, 0.1245453134, 0.0443356298, -0.4416728914, 0.3375267088, 0.2412355989, -0.2255858779, -0.2444110513, 0.0952859521, -0.2509182394, -0.2328004688, 0.1970369965, 0.1555832624, -0.1784608364, -0.0209630895, -0.1068923473, 0.0988961756, 0.1280108541, 0.2582721114, 0.0263723116, -0.4864166975, -0.3809947371, -0.3249777853, -0.0254871044, 0.3954321742, -0.4154388607, -0.2039043754, 0.0394426323, -0.0463084169, 0.1385590732, 0.253090322, -0.3661012352, 0.1451613158, -0.2393055409, 0.2845744491, 0.5265448689, 0.0433981605, -0.2177200019, 0.4294439256, 0.1565903127, 0.3267547786, 0.1860678196, 0.0742608681, 0.0775936022, 0.1260917783, 0.159499824, 0.4206008613, 0.165720731, 0.0673818663, -0.18377693, -0.1553833932, 0.1656041145, -0.0030712972, -0.3288174272, 0.3090260327, 0.2257002294, -0.5133963823, 0.2171114683, -0.1282682419, -0.2264052182, -0.0468895957, 0.4030794203, 0.5202860236, 0.0057924916, -0.0192436595, -0.4824978709, 0.224633202, -0.1493486613, -0.0522527508, -0.0067958659, -0.3252949715, -0.493493557, -0.0567669384, -0.2471698523, 0.1995169371, 0.0646641627, 0.3136297166, -0.3358725905, 0.158852607, -0.0870927721, 0.0709816441, -0.2088876516, -0.25216344, -0.0801554844, -0.021776313, 0.1720781028, -0.0900507495, 0.01579234, 0.0775027573, 0.2781895399, 0.0767477602, -0.3883280158, 0.1277151853, 0.279560715, 0.1613470018, -0.1129956543, 0.2116078883, -0.0030282589, -0.009514099, -0.0278552249, 0.1732269377, 0.193562746, -0.0937049389, -0.0290853269, 0.6565467119, 0.1539307684, 0.2489784956, -0.2678476572, -0.1128535122, 0.2808353603, -0.0006698508, -0.1841067672, -0.0670059398, -0.2146352232, -0.048521243, 0.0014962169, 0.4216480851, -0.3299657106, -0.115778476, 0.478890866, 0.095458962, 0.1291624308, -0.080403693, -0.0172786433, -0.029092418, 0.0167227127, -0.2370506227, 0.4729242921, -0.061082568, -0.080364868, -0.0082822768, 0.0192123782, -0.2243367732, 0.0600000061, -0.1394983381, -0.1910201758, 0.2915715873, 0.0343267173, -0.1579159945, -0.3376891017, 0.2412528396, -0.1466076523, -0.2058870494, -0.634283483, -0.0990625322, -0.5823048949, 0.1683029234, -0.4637624919, -0.0822288096, -0.0697952658, 0.0163360965, -0.212019518, 0.1033788621, -0.0353965051, 0.0900430083, -0.1784477383, 0.3625628948, 0.0643080547, -0.8123736978, 0.2222117037, 0.1188195497, -0.4499815106, -0.0581740849, 0.174991563, 0.2886115611, 0.0355603211, 0.0289641507, -0.2870356739, 0.0080763334, -0.0132932961, -0.1399181932, 0.1707452834, 0.5402768254, 0.1732702106, 0.175692305, 0.1394032687, -0.1260673404, 0.398373872, -0.0131173255, 0.0591226555, -0.1250231266, -0.0263377354, 0.1114318445, -0.2428705692, -0.6793347597, -0.1501976699, -0.2003139704, 0.284424603, 0.213961944, 0.0511259139, 0.1971265674, 0.3683051765, -0.2396501601, 0.1546969116, -0.0263571627, -0.2073858976, -0.0725121871, 0.4438348711, -0.1748047769, -0.2186149061, 0.0093016028, -0.3093700707, -0.3122232556, 0.1340719014, -0.3119172156, 0.0612177253, -0.3492911458, 0.5237388015, 0.0541129336, 0.0240740888, 0.1082264259, -0.1130078882, 0.0396240726, -0.175863564, -0.3381879926, 0.4521702528, 0.3127172291, 0.0991489291, 0.4245265126, -0.025254583, -0.4129970968, 0.4985537827, -0.2855619788, -0.1919136345, 0.595359683, -0.1800898165, 0.1787188053, -0.0728686377, -0.2670248449, -0.1126027256, -0.0425650217, -0.1116567105, 0.2236915827, -0.0085568978, -0.270024538, -0.1810300201, 0.2123803496, -0.2176176012, -0.2608530521, 0.2379057109, 0.1473992616, -0.0105133532, -0.2122009844, -0.0562984981, -0.3047745228, -0.001116173, -0.0551237576, 0.4722040594, -0.1199500561, -0.0018577781, -0.3208263218, 0.2846592367, 0.0782867968, 0.1430099159, 0.2052049339, 0.0887331888, 0.0514348447, -0.2681928575, -0.0241439641, 0.1990230978, 0.2873642445, 0.0269078892, 0.1157548726, 0.2087190747, -0.1225695387, -0.0485271402, -0.3683555126, 0.1046844646, -0.098024264, -0.1456139833, 0.4273831546, -0.0174690131, -0.2047404349, 0.0689943209, 0.1473539621, -0.3237197101, -0.3246999383, -0.0766782239, -0.1038024649, 0.0663046166, -0.1572972536, 0.0566511713, 0.2637955844, -0.4567133486, -0.294929564, -0.3002609611, -0.0669391602, 0.4277198613, 0.0272209533, 0.3608856201, 0.0342605636, -0.1682981551, -0.0919504613, 0.3646994531, -0.2676112652, 0.5217869878, -0.0273078084, -0.3972114921, -0.1356139779, -0.2784287333, 0.1692487448, 0.2122792155, -0.3540076315, 0.0106411939, 0.0537485257, -0.1274202764, -0.3462888896, 0.4716669917, 0.4681009948, -0.1359973401, 0.170507893, -0.7704424262, 0.3951098025, -0.2586806715, -0.1935912073, -0.0233426243, -0.2719201446, -0.2325713784, 0.3815224767, 0.0811238512, 0.6033580303, -0.1063163877, 0.1100442857, 0.2331686765, 0.2517561316, 0.0767839924, 0.0193489678, -0.1155479178, -0.225033462, 0.104447186, -0.0204280075, -0.0284993909, 0.1987365633, 0.4217335582, 0.0612301044, 0.0763240755, -0.2039118558, 0.462703079, -0.1451128423, 0.1012346074, 0.0826516747, -0.2062902451, -0.1408654302, 0.0782317221, -0.0795416161, 0.2758698165, 0.0676955432, -0.1689652801, 0.0029450401, -0.2168520689, 0.0900495499, -0.1180126742, -0.3544567227, 0.1029872522, -0.0903589651, -0.1665311307, 0.049425263, 0.4377086759, 0.0453952514, 0.0724742115, 0.0026919448, -0.0892433301, 0.3455888629, 0.0723929554, -0.3652018309, 0.0003103189, 0.1250232309, 0.1094891131, -0.4165463448, -0.2229628414, 0.0246598665, -0.2354822457, -0.1175186783, -0.1140047461, -0.0075322008, -0.5912169218, -0.5814697146, -0.2086250782, 0.1575358659, 0.0230600964, 0.0865534917, -0.1536921263, 0.0544933639, 0.4086309373, 0.0256566536, -0.2936864793, -0.2414159328, 0.1097038239, 0.0934435576, -0.1074569076, 0.4937070906, -0.1585170627, 0.0675677583, -0.233401224, 0.1656763554, 0.0291344356, -0.2786065638, 0.1651808619, 0.2246357352, -0.2610380054, -0.1285683513, 0.6697030663, 0.0992184132, 0.3524081707, 0.0855975971, -0.3124062419, -0.3024980724, -0.1660955846, 0.1188771799, 0.3957428336, 0.0464487858, 0.1652832925, 0.141623348, -0.2059976459, -0.248338148, 0.0333892889, 0.115163967, 0.0171486139, 0.1608876735, 0.1793147624, 0.0733210593, 0.2779512107, 0.155892849, -0.0744744167, -0.0549421161, -0.1906138062, -0.2437295169, 0.1428410858, -0.1014105082, 0.2073238045, -0.1902384013, -0.2917288244, 0.1587089747, -0.2286085486, 0.1630495787, 0.2692561448, -0.0584337339, 0.5097594261, -0.1074662954, 0.2579499185, -0.0396137796, 0.3279566467, -0.183143124, 0.0911631808, 0.2839573324, -0.1068137363, -0.0950942561, 0.0866203532, -0.138792783, -0.2092009634, -0.2366230935, 0.3477985859, -0.0584279336, -0.1488166153, -0.0404732414, 0.2657980919, 0.1655935645, 0.4483642876, -0.0675903708, 0.0337993465, 0.1700199693, 0.2013855129, -0.137362048, 0.0610726327, 0.2482621521, 0.0578230061, 0.1259522587, 0.5288023949, 0.4163005948, -0.060954541, -0.1263368726, -0.2910685539, 0.1425028443, 0.1937830001, 0.1487295479, 0.3334578276, 0.0122656208, -0.0583517365, 0.0439712107, 0.1607936919, 0.1520166993, 0.3418110609, 0.02927812, -0.2028437555, 0.0008464457, 0.1873263121, 0.0220550299, -0.6729873419, 0.3362362683, 0.1451907009, -0.2824924588, 0.3987860978, 0.0277418867, 0.3040841818, -0.2217608839, -0.2226591855, -0.1894538105, 0.0515003428, -0.0737109482, -0.2347967178, -0.1169680506, -0.1961245239, -0.3086969852, -0.1200801358, 0.0403750166, 0.1298111528, 0.0409612283, 0.067796886, -0.057139691, -0.1646536887, 0.1864994019, -0.2584421337, 0.2858180404, 0.0312480219, 0.0454406366, -0.0801775157, 0.1768497825, 0.2635410428, -0.0922866687, -0.0588778891, 0.6529514194, -0.0708789527, -0.2127461135, -0.0827962384, 0.0492601097, -0.1479174644, -0.1888011545, -0.0592487641, 0.5324174762, 0.2739832699, 0.1294230521, -0.1248223484, 0.2267606854, -0.2451611012, 0.2631816268, -0.6641116738, 0.3068289161, 0.2461197823, 0.0778737515, -0.1524754018, 0.067432262, -0.1703534126, -0.1933409274, 0.4078930914, 0.3887723386, 0.5386597514, 0.0947168022, 0.0588995554, -0.2939715385, 0.2791741192, -0.2840402126, 0.0861396715, -0.0574958958, 0.2992790937, -0.7319203019, -0.0987627134, 0.2255545706, -0.1211580709, 0.1216319874, 0.2576981485, 0.0417751111, 0.11881008, -0.1557263732, -0.0532567985, 0.3186097443, 0.082505852, -0.1304461211, -0.2680416703, -0.1397156268, 0.181989938, 0.0978386998, -0.3734223247, -0.0446044989, 0.0930456445, 0.0255390778, -0.038303677, -0.2225392759, 0.0113507258, 0.0509980246, 0.2269795984, 0.0419546254, 0.1949174404, -0.0109647913, 0.1166931912, -0.2026651204, -0.0816120803, -0.1552952975, 0.0546444133, -0.2456045896, 0.5321159363, -0.3866824508, 0.5693585873, -0.4407522082, 0.1738171875, 0.2310235351, -0.4541363418, 0.0961408988, -0.0945511237, -0.1327077001, -0.1259730011, 0.0628546402, 0.3869295716, -0.1089816019, 0.1471087784, 0.1429866552, -0.3117976487, 0.3475707471, -0.0603822619, -0.2231803834, -0.0993921012, 0.224429816, 0.1183505505, 0.3281213939, -0.3093107343, -0.0371793881, 0.4952086806, -0.1033607647, 0.2260008007, 0.1840547323, -0.3150682151, 0.0563163161, -0.1813354343, 0.1425452828, 0.0503484085, 0.2422546148, -0.2390479445, -0.4779425263 ]
https://github.com/huggingface/datasets/issues/623
Custom feature types in `load_dataset` from CSV
> In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq? > > Should I add it? Sure let's add it. Setting the convert options should do the job > Hi @lhoestq we've tried out your suggestion but are now running into the following error: > > ``` > --------------------------------------------------------------------------- > ValueError Traceback (most recent call last) > <ipython-input-163-81ffd5ac18c9> in <module> > ----> 1 dataset.cast_(emotion_features) > > /usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast() > > ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text'] > ``` > > Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬 Thanks for reporting, that's a bug :) I'm fixing it right now
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction.
136
Custom feature types in `load_dataset` from CSV I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction. > In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq? > > Should I add it? Sure let's add it. Setting the convert options should do the job > Hi @lhoestq we've tried out your suggestion but are now running into the following error: > > ``` > --------------------------------------------------------------------------- > ValueError Traceback (most recent call last) > <ipython-input-163-81ffd5ac18c9> in <module> > ----> 1 dataset.cast_(emotion_features) > > /usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast() > > ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text'] > ``` > > Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬 Thanks for reporting, that's a bug :) I'm fixing it right now
[ 0.0802028924, -0.2782892585, -0.0531790853, 0.3509229124, 0.3172289729, -0.1943105757, 0.5701336265, 0.1113842726, 0.446125567, 0.0253306851, 0.0947441235, 0.3161779642, -0.0919102132, 0.3901152909, -0.0581882037, 0.0267203413, -0.1612748355, 0.3348048329, -0.0091214385, -0.3497940302, -0.2713249922, 0.1799539477, -0.0930471718, -0.0134864599, -0.3072170615, 0.339589268, 0.2221690416, 0.1434387118, 0.0583123192, -0.3765772283, 0.4237109125, 0.1486944854, 0.3030694425, 0.0801389515, -0.0001151109, 0.0768829808, 0.0293593239, -0.1740054041, -0.0040853415, -0.3799197078, -0.038784463, -0.2029064894, 0.4247083366, -0.3651530743, -0.2385734171, -0.4564033449, -0.2810541391, -0.1292718649, 0.2869226038, 0.3292907774, 0.1512022316, -0.0502677187, -0.2750737965, 0.2184947878, 0.3587990701, 0.6755333543, -0.2523881793, 0.1870211363, -0.040634457, -0.1123655066, 0.0939734951, -0.1022862494, -0.1438640207, 0.3534233272, 0.4926103055, 0.171061635, -0.0643915236, -0.1303498, -0.173328042, 0.2814248204, 0.3474105, 0.0562937185, -0.0464357696, -0.3231964111, -0.1238630563, -0.2973287702, 0.3824171722, 0.084860377, -0.1818488538, 0.160442397, -0.0789407343, 0.4355743825, -0.0581504107, 0.325290978, 0.0186877474, -0.0715496317, -0.2392114103, 0.1055342034, 0.0308265928, -0.21731098, 0.0974366665, -0.3491620421, 0.2218384147, 0.1172009334, -0.0551005341, 0.0995840505, 0.0039352379, -0.0604649708, -0.1210800037, 0.0352325104, 0.2292757183, 0.1932828724, -0.1932465136, 0.0317142755, 0.2777895629, 0.244182542, 0.2002113461, -0.2317832112, 0.1527377069, 0.1047159582, -0.423279047, 0.0183333308, 0.0277892873, -0.3080181479, 0.3964600861, 0.0869554058, 0.5022858381, -0.2398284972, 0.0576626956, -0.098011978, 0.0428097956, -0.0321921073, 0.1175667867, 0.183557108, -0.0262655262, 0.5809873343, -0.0656144843, 0.1488877982, -0.3211800158, 0.1283436269, -0.0581270903, -0.2226471007, -0.0374677889, -0.0493202247, 0.403034538, 0.0941047147, 0.2478336245, 0.1990264207, -0.0237023886, -0.3186683953, -0.1270062774, -0.0959564075, 0.1245453134, 0.0443356298, -0.4416728914, 0.3375267088, 0.2412355989, -0.2255858779, -0.2444110513, 0.0952859521, -0.2509182394, -0.2328004688, 0.1970369965, 0.1555832624, -0.1784608364, -0.0209630895, -0.1068923473, 0.0988961756, 0.1280108541, 0.2582721114, 0.0263723116, -0.4864166975, -0.3809947371, -0.3249777853, -0.0254871044, 0.3954321742, -0.4154388607, -0.2039043754, 0.0394426323, -0.0463084169, 0.1385590732, 0.253090322, -0.3661012352, 0.1451613158, -0.2393055409, 0.2845744491, 0.5265448689, 0.0433981605, -0.2177200019, 0.4294439256, 0.1565903127, 0.3267547786, 0.1860678196, 0.0742608681, 0.0775936022, 0.1260917783, 0.159499824, 0.4206008613, 0.165720731, 0.0673818663, -0.18377693, -0.1553833932, 0.1656041145, -0.0030712972, -0.3288174272, 0.3090260327, 0.2257002294, -0.5133963823, 0.2171114683, -0.1282682419, -0.2264052182, -0.0468895957, 0.4030794203, 0.5202860236, 0.0057924916, -0.0192436595, -0.4824978709, 0.224633202, -0.1493486613, -0.0522527508, -0.0067958659, -0.3252949715, -0.493493557, -0.0567669384, -0.2471698523, 0.1995169371, 0.0646641627, 0.3136297166, -0.3358725905, 0.158852607, -0.0870927721, 0.0709816441, -0.2088876516, -0.25216344, -0.0801554844, -0.021776313, 0.1720781028, -0.0900507495, 0.01579234, 0.0775027573, 0.2781895399, 0.0767477602, -0.3883280158, 0.1277151853, 0.279560715, 0.1613470018, -0.1129956543, 0.2116078883, -0.0030282589, -0.009514099, -0.0278552249, 0.1732269377, 0.193562746, -0.0937049389, -0.0290853269, 0.6565467119, 0.1539307684, 0.2489784956, -0.2678476572, -0.1128535122, 0.2808353603, -0.0006698508, -0.1841067672, -0.0670059398, -0.2146352232, -0.048521243, 0.0014962169, 0.4216480851, -0.3299657106, -0.115778476, 0.478890866, 0.095458962, 0.1291624308, -0.080403693, -0.0172786433, -0.029092418, 0.0167227127, -0.2370506227, 0.4729242921, -0.061082568, -0.080364868, -0.0082822768, 0.0192123782, -0.2243367732, 0.0600000061, -0.1394983381, -0.1910201758, 0.2915715873, 0.0343267173, -0.1579159945, -0.3376891017, 0.2412528396, -0.1466076523, -0.2058870494, -0.634283483, -0.0990625322, -0.5823048949, 0.1683029234, -0.4637624919, -0.0822288096, -0.0697952658, 0.0163360965, -0.212019518, 0.1033788621, -0.0353965051, 0.0900430083, -0.1784477383, 0.3625628948, 0.0643080547, -0.8123736978, 0.2222117037, 0.1188195497, -0.4499815106, -0.0581740849, 0.174991563, 0.2886115611, 0.0355603211, 0.0289641507, -0.2870356739, 0.0080763334, -0.0132932961, -0.1399181932, 0.1707452834, 0.5402768254, 0.1732702106, 0.175692305, 0.1394032687, -0.1260673404, 0.398373872, -0.0131173255, 0.0591226555, -0.1250231266, -0.0263377354, 0.1114318445, -0.2428705692, -0.6793347597, -0.1501976699, -0.2003139704, 0.284424603, 0.213961944, 0.0511259139, 0.1971265674, 0.3683051765, -0.2396501601, 0.1546969116, -0.0263571627, -0.2073858976, -0.0725121871, 0.4438348711, -0.1748047769, -0.2186149061, 0.0093016028, -0.3093700707, -0.3122232556, 0.1340719014, -0.3119172156, 0.0612177253, -0.3492911458, 0.5237388015, 0.0541129336, 0.0240740888, 0.1082264259, -0.1130078882, 0.0396240726, -0.175863564, -0.3381879926, 0.4521702528, 0.3127172291, 0.0991489291, 0.4245265126, -0.025254583, -0.4129970968, 0.4985537827, -0.2855619788, -0.1919136345, 0.595359683, -0.1800898165, 0.1787188053, -0.0728686377, -0.2670248449, -0.1126027256, -0.0425650217, -0.1116567105, 0.2236915827, -0.0085568978, -0.270024538, -0.1810300201, 0.2123803496, -0.2176176012, -0.2608530521, 0.2379057109, 0.1473992616, -0.0105133532, -0.2122009844, -0.0562984981, -0.3047745228, -0.001116173, -0.0551237576, 0.4722040594, -0.1199500561, -0.0018577781, -0.3208263218, 0.2846592367, 0.0782867968, 0.1430099159, 0.2052049339, 0.0887331888, 0.0514348447, -0.2681928575, -0.0241439641, 0.1990230978, 0.2873642445, 0.0269078892, 0.1157548726, 0.2087190747, -0.1225695387, -0.0485271402, -0.3683555126, 0.1046844646, -0.098024264, -0.1456139833, 0.4273831546, -0.0174690131, -0.2047404349, 0.0689943209, 0.1473539621, -0.3237197101, -0.3246999383, -0.0766782239, -0.1038024649, 0.0663046166, -0.1572972536, 0.0566511713, 0.2637955844, -0.4567133486, -0.294929564, -0.3002609611, -0.0669391602, 0.4277198613, 0.0272209533, 0.3608856201, 0.0342605636, -0.1682981551, -0.0919504613, 0.3646994531, -0.2676112652, 0.5217869878, -0.0273078084, -0.3972114921, -0.1356139779, -0.2784287333, 0.1692487448, 0.2122792155, -0.3540076315, 0.0106411939, 0.0537485257, -0.1274202764, -0.3462888896, 0.4716669917, 0.4681009948, -0.1359973401, 0.170507893, -0.7704424262, 0.3951098025, -0.2586806715, -0.1935912073, -0.0233426243, -0.2719201446, -0.2325713784, 0.3815224767, 0.0811238512, 0.6033580303, -0.1063163877, 0.1100442857, 0.2331686765, 0.2517561316, 0.0767839924, 0.0193489678, -0.1155479178, -0.225033462, 0.104447186, -0.0204280075, -0.0284993909, 0.1987365633, 0.4217335582, 0.0612301044, 0.0763240755, -0.2039118558, 0.462703079, -0.1451128423, 0.1012346074, 0.0826516747, -0.2062902451, -0.1408654302, 0.0782317221, -0.0795416161, 0.2758698165, 0.0676955432, -0.1689652801, 0.0029450401, -0.2168520689, 0.0900495499, -0.1180126742, -0.3544567227, 0.1029872522, -0.0903589651, -0.1665311307, 0.049425263, 0.4377086759, 0.0453952514, 0.0724742115, 0.0026919448, -0.0892433301, 0.3455888629, 0.0723929554, -0.3652018309, 0.0003103189, 0.1250232309, 0.1094891131, -0.4165463448, -0.2229628414, 0.0246598665, -0.2354822457, -0.1175186783, -0.1140047461, -0.0075322008, -0.5912169218, -0.5814697146, -0.2086250782, 0.1575358659, 0.0230600964, 0.0865534917, -0.1536921263, 0.0544933639, 0.4086309373, 0.0256566536, -0.2936864793, -0.2414159328, 0.1097038239, 0.0934435576, -0.1074569076, 0.4937070906, -0.1585170627, 0.0675677583, -0.233401224, 0.1656763554, 0.0291344356, -0.2786065638, 0.1651808619, 0.2246357352, -0.2610380054, -0.1285683513, 0.6697030663, 0.0992184132, 0.3524081707, 0.0855975971, -0.3124062419, -0.3024980724, -0.1660955846, 0.1188771799, 0.3957428336, 0.0464487858, 0.1652832925, 0.141623348, -0.2059976459, -0.248338148, 0.0333892889, 0.115163967, 0.0171486139, 0.1608876735, 0.1793147624, 0.0733210593, 0.2779512107, 0.155892849, -0.0744744167, -0.0549421161, -0.1906138062, -0.2437295169, 0.1428410858, -0.1014105082, 0.2073238045, -0.1902384013, -0.2917288244, 0.1587089747, -0.2286085486, 0.1630495787, 0.2692561448, -0.0584337339, 0.5097594261, -0.1074662954, 0.2579499185, -0.0396137796, 0.3279566467, -0.183143124, 0.0911631808, 0.2839573324, -0.1068137363, -0.0950942561, 0.0866203532, -0.138792783, -0.2092009634, -0.2366230935, 0.3477985859, -0.0584279336, -0.1488166153, -0.0404732414, 0.2657980919, 0.1655935645, 0.4483642876, -0.0675903708, 0.0337993465, 0.1700199693, 0.2013855129, -0.137362048, 0.0610726327, 0.2482621521, 0.0578230061, 0.1259522587, 0.5288023949, 0.4163005948, -0.060954541, -0.1263368726, -0.2910685539, 0.1425028443, 0.1937830001, 0.1487295479, 0.3334578276, 0.0122656208, -0.0583517365, 0.0439712107, 0.1607936919, 0.1520166993, 0.3418110609, 0.02927812, -0.2028437555, 0.0008464457, 0.1873263121, 0.0220550299, -0.6729873419, 0.3362362683, 0.1451907009, -0.2824924588, 0.3987860978, 0.0277418867, 0.3040841818, -0.2217608839, -0.2226591855, -0.1894538105, 0.0515003428, -0.0737109482, -0.2347967178, -0.1169680506, -0.1961245239, -0.3086969852, -0.1200801358, 0.0403750166, 0.1298111528, 0.0409612283, 0.067796886, -0.057139691, -0.1646536887, 0.1864994019, -0.2584421337, 0.2858180404, 0.0312480219, 0.0454406366, -0.0801775157, 0.1768497825, 0.2635410428, -0.0922866687, -0.0588778891, 0.6529514194, -0.0708789527, -0.2127461135, -0.0827962384, 0.0492601097, -0.1479174644, -0.1888011545, -0.0592487641, 0.5324174762, 0.2739832699, 0.1294230521, -0.1248223484, 0.2267606854, -0.2451611012, 0.2631816268, -0.6641116738, 0.3068289161, 0.2461197823, 0.0778737515, -0.1524754018, 0.067432262, -0.1703534126, -0.1933409274, 0.4078930914, 0.3887723386, 0.5386597514, 0.0947168022, 0.0588995554, -0.2939715385, 0.2791741192, -0.2840402126, 0.0861396715, -0.0574958958, 0.2992790937, -0.7319203019, -0.0987627134, 0.2255545706, -0.1211580709, 0.1216319874, 0.2576981485, 0.0417751111, 0.11881008, -0.1557263732, -0.0532567985, 0.3186097443, 0.082505852, -0.1304461211, -0.2680416703, -0.1397156268, 0.181989938, 0.0978386998, -0.3734223247, -0.0446044989, 0.0930456445, 0.0255390778, -0.038303677, -0.2225392759, 0.0113507258, 0.0509980246, 0.2269795984, 0.0419546254, 0.1949174404, -0.0109647913, 0.1166931912, -0.2026651204, -0.0816120803, -0.1552952975, 0.0546444133, -0.2456045896, 0.5321159363, -0.3866824508, 0.5693585873, -0.4407522082, 0.1738171875, 0.2310235351, -0.4541363418, 0.0961408988, -0.0945511237, -0.1327077001, -0.1259730011, 0.0628546402, 0.3869295716, -0.1089816019, 0.1471087784, 0.1429866552, -0.3117976487, 0.3475707471, -0.0603822619, -0.2231803834, -0.0993921012, 0.224429816, 0.1183505505, 0.3281213939, -0.3093107343, -0.0371793881, 0.4952086806, -0.1033607647, 0.2260008007, 0.1840547323, -0.3150682151, 0.0563163161, -0.1813354343, 0.1425452828, 0.0503484085, 0.2422546148, -0.2390479445, -0.4779425263 ]
https://github.com/huggingface/datasets/issues/623
Custom feature types in `load_dataset` from CSV
PR is open for the `ValueError: Target schema's field names are not matching the table's field names` error. I'm adding the features parameter to csv
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction.
25
Custom feature types in `load_dataset` from CSV I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`. I am working with the local files from the emotion dataset. To get the data you can use the following code: ```Python from pathlib import Path import wget EMOTION_PATH = Path("./data/emotion") DOWNLOAD_URLS = [ "https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1", "https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1", "https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1", ] if not Path.is_dir(EMOTION_PATH): Path.mkdir(EMOTION_PATH) for url in DOWNLOAD_URLS: wget.download(url, str(EMOTION_PATH)) ``` The first five lines of the train set are: ``` i didnt feel humiliated;sadness i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness im grabbing a minute to post i feel greedy wrong;anger i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love i am feeling grouchy;anger ``` Here the code to reproduce the issue: ```Python from datasets import Features, Value, ClassLabel, load_dataset class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"] emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)}) file_dict = {'train': EMOTION_PATH/'train.txt'} dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features) ``` **Observed behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': Value(dtype='string', id=None)} ``` **Expected behaviour:** ```Python dataset['train'].features ``` ```Python {'text': Value(dtype='string', id=None), 'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)} ``` **Things I've tried:** - deleting the cache - trying other types such as `int64` Am I missing anything? Thanks for any pointer in the right direction. PR is open for the `ValueError: Target schema's field names are not matching the table's field names` error. I'm adding the features parameter to csv
[ 0.0802028924, -0.2782892585, -0.0531790853, 0.3509229124, 0.3172289729, -0.1943105757, 0.5701336265, 0.1113842726, 0.446125567, 0.0253306851, 0.0947441235, 0.3161779642, -0.0919102132, 0.3901152909, -0.0581882037, 0.0267203413, -0.1612748355, 0.3348048329, -0.0091214385, -0.3497940302, -0.2713249922, 0.1799539477, -0.0930471718, -0.0134864599, -0.3072170615, 0.339589268, 0.2221690416, 0.1434387118, 0.0583123192, -0.3765772283, 0.4237109125, 0.1486944854, 0.3030694425, 0.0801389515, -0.0001151109, 0.0768829808, 0.0293593239, -0.1740054041, -0.0040853415, -0.3799197078, -0.038784463, -0.2029064894, 0.4247083366, -0.3651530743, -0.2385734171, -0.4564033449, -0.2810541391, -0.1292718649, 0.2869226038, 0.3292907774, 0.1512022316, -0.0502677187, -0.2750737965, 0.2184947878, 0.3587990701, 0.6755333543, -0.2523881793, 0.1870211363, -0.040634457, -0.1123655066, 0.0939734951, -0.1022862494, -0.1438640207, 0.3534233272, 0.4926103055, 0.171061635, -0.0643915236, -0.1303498, -0.173328042, 0.2814248204, 0.3474105, 0.0562937185, -0.0464357696, -0.3231964111, -0.1238630563, -0.2973287702, 0.3824171722, 0.084860377, -0.1818488538, 0.160442397, -0.0789407343, 0.4355743825, -0.0581504107, 0.325290978, 0.0186877474, -0.0715496317, -0.2392114103, 0.1055342034, 0.0308265928, -0.21731098, 0.0974366665, -0.3491620421, 0.2218384147, 0.1172009334, -0.0551005341, 0.0995840505, 0.0039352379, -0.0604649708, -0.1210800037, 0.0352325104, 0.2292757183, 0.1932828724, -0.1932465136, 0.0317142755, 0.2777895629, 0.244182542, 0.2002113461, -0.2317832112, 0.1527377069, 0.1047159582, -0.423279047, 0.0183333308, 0.0277892873, -0.3080181479, 0.3964600861, 0.0869554058, 0.5022858381, -0.2398284972, 0.0576626956, -0.098011978, 0.0428097956, -0.0321921073, 0.1175667867, 0.183557108, -0.0262655262, 0.5809873343, -0.0656144843, 0.1488877982, -0.3211800158, 0.1283436269, -0.0581270903, -0.2226471007, -0.0374677889, -0.0493202247, 0.403034538, 0.0941047147, 0.2478336245, 0.1990264207, -0.0237023886, -0.3186683953, -0.1270062774, -0.0959564075, 0.1245453134, 0.0443356298, -0.4416728914, 0.3375267088, 0.2412355989, -0.2255858779, -0.2444110513, 0.0952859521, -0.2509182394, -0.2328004688, 0.1970369965, 0.1555832624, -0.1784608364, -0.0209630895, -0.1068923473, 0.0988961756, 0.1280108541, 0.2582721114, 0.0263723116, -0.4864166975, -0.3809947371, -0.3249777853, -0.0254871044, 0.3954321742, -0.4154388607, -0.2039043754, 0.0394426323, -0.0463084169, 0.1385590732, 0.253090322, -0.3661012352, 0.1451613158, -0.2393055409, 0.2845744491, 0.5265448689, 0.0433981605, -0.2177200019, 0.4294439256, 0.1565903127, 0.3267547786, 0.1860678196, 0.0742608681, 0.0775936022, 0.1260917783, 0.159499824, 0.4206008613, 0.165720731, 0.0673818663, -0.18377693, -0.1553833932, 0.1656041145, -0.0030712972, -0.3288174272, 0.3090260327, 0.2257002294, -0.5133963823, 0.2171114683, -0.1282682419, -0.2264052182, -0.0468895957, 0.4030794203, 0.5202860236, 0.0057924916, -0.0192436595, -0.4824978709, 0.224633202, -0.1493486613, -0.0522527508, -0.0067958659, -0.3252949715, -0.493493557, -0.0567669384, -0.2471698523, 0.1995169371, 0.0646641627, 0.3136297166, -0.3358725905, 0.158852607, -0.0870927721, 0.0709816441, -0.2088876516, -0.25216344, -0.0801554844, -0.021776313, 0.1720781028, -0.0900507495, 0.01579234, 0.0775027573, 0.2781895399, 0.0767477602, -0.3883280158, 0.1277151853, 0.279560715, 0.1613470018, -0.1129956543, 0.2116078883, -0.0030282589, -0.009514099, -0.0278552249, 0.1732269377, 0.193562746, -0.0937049389, -0.0290853269, 0.6565467119, 0.1539307684, 0.2489784956, -0.2678476572, -0.1128535122, 0.2808353603, -0.0006698508, -0.1841067672, -0.0670059398, -0.2146352232, -0.048521243, 0.0014962169, 0.4216480851, -0.3299657106, -0.115778476, 0.478890866, 0.095458962, 0.1291624308, -0.080403693, -0.0172786433, -0.029092418, 0.0167227127, -0.2370506227, 0.4729242921, -0.061082568, -0.080364868, -0.0082822768, 0.0192123782, -0.2243367732, 0.0600000061, -0.1394983381, -0.1910201758, 0.2915715873, 0.0343267173, -0.1579159945, -0.3376891017, 0.2412528396, -0.1466076523, -0.2058870494, -0.634283483, -0.0990625322, -0.5823048949, 0.1683029234, -0.4637624919, -0.0822288096, -0.0697952658, 0.0163360965, -0.212019518, 0.1033788621, -0.0353965051, 0.0900430083, -0.1784477383, 0.3625628948, 0.0643080547, -0.8123736978, 0.2222117037, 0.1188195497, -0.4499815106, -0.0581740849, 0.174991563, 0.2886115611, 0.0355603211, 0.0289641507, -0.2870356739, 0.0080763334, -0.0132932961, -0.1399181932, 0.1707452834, 0.5402768254, 0.1732702106, 0.175692305, 0.1394032687, -0.1260673404, 0.398373872, -0.0131173255, 0.0591226555, -0.1250231266, -0.0263377354, 0.1114318445, -0.2428705692, -0.6793347597, -0.1501976699, -0.2003139704, 0.284424603, 0.213961944, 0.0511259139, 0.1971265674, 0.3683051765, -0.2396501601, 0.1546969116, -0.0263571627, -0.2073858976, -0.0725121871, 0.4438348711, -0.1748047769, -0.2186149061, 0.0093016028, -0.3093700707, -0.3122232556, 0.1340719014, -0.3119172156, 0.0612177253, -0.3492911458, 0.5237388015, 0.0541129336, 0.0240740888, 0.1082264259, -0.1130078882, 0.0396240726, -0.175863564, -0.3381879926, 0.4521702528, 0.3127172291, 0.0991489291, 0.4245265126, -0.025254583, -0.4129970968, 0.4985537827, -0.2855619788, -0.1919136345, 0.595359683, -0.1800898165, 0.1787188053, -0.0728686377, -0.2670248449, -0.1126027256, -0.0425650217, -0.1116567105, 0.2236915827, -0.0085568978, -0.270024538, -0.1810300201, 0.2123803496, -0.2176176012, -0.2608530521, 0.2379057109, 0.1473992616, -0.0105133532, -0.2122009844, -0.0562984981, -0.3047745228, -0.001116173, -0.0551237576, 0.4722040594, -0.1199500561, -0.0018577781, -0.3208263218, 0.2846592367, 0.0782867968, 0.1430099159, 0.2052049339, 0.0887331888, 0.0514348447, -0.2681928575, -0.0241439641, 0.1990230978, 0.2873642445, 0.0269078892, 0.1157548726, 0.2087190747, -0.1225695387, -0.0485271402, -0.3683555126, 0.1046844646, -0.098024264, -0.1456139833, 0.4273831546, -0.0174690131, -0.2047404349, 0.0689943209, 0.1473539621, -0.3237197101, -0.3246999383, -0.0766782239, -0.1038024649, 0.0663046166, -0.1572972536, 0.0566511713, 0.2637955844, -0.4567133486, -0.294929564, -0.3002609611, -0.0669391602, 0.4277198613, 0.0272209533, 0.3608856201, 0.0342605636, -0.1682981551, -0.0919504613, 0.3646994531, -0.2676112652, 0.5217869878, -0.0273078084, -0.3972114921, -0.1356139779, -0.2784287333, 0.1692487448, 0.2122792155, -0.3540076315, 0.0106411939, 0.0537485257, -0.1274202764, -0.3462888896, 0.4716669917, 0.4681009948, -0.1359973401, 0.170507893, -0.7704424262, 0.3951098025, -0.2586806715, -0.1935912073, -0.0233426243, -0.2719201446, -0.2325713784, 0.3815224767, 0.0811238512, 0.6033580303, -0.1063163877, 0.1100442857, 0.2331686765, 0.2517561316, 0.0767839924, 0.0193489678, -0.1155479178, -0.225033462, 0.104447186, -0.0204280075, -0.0284993909, 0.1987365633, 0.4217335582, 0.0612301044, 0.0763240755, -0.2039118558, 0.462703079, -0.1451128423, 0.1012346074, 0.0826516747, -0.2062902451, -0.1408654302, 0.0782317221, -0.0795416161, 0.2758698165, 0.0676955432, -0.1689652801, 0.0029450401, -0.2168520689, 0.0900495499, -0.1180126742, -0.3544567227, 0.1029872522, -0.0903589651, -0.1665311307, 0.049425263, 0.4377086759, 0.0453952514, 0.0724742115, 0.0026919448, -0.0892433301, 0.3455888629, 0.0723929554, -0.3652018309, 0.0003103189, 0.1250232309, 0.1094891131, -0.4165463448, -0.2229628414, 0.0246598665, -0.2354822457, -0.1175186783, -0.1140047461, -0.0075322008, -0.5912169218, -0.5814697146, -0.2086250782, 0.1575358659, 0.0230600964, 0.0865534917, -0.1536921263, 0.0544933639, 0.4086309373, 0.0256566536, -0.2936864793, -0.2414159328, 0.1097038239, 0.0934435576, -0.1074569076, 0.4937070906, -0.1585170627, 0.0675677583, -0.233401224, 0.1656763554, 0.0291344356, -0.2786065638, 0.1651808619, 0.2246357352, -0.2610380054, -0.1285683513, 0.6697030663, 0.0992184132, 0.3524081707, 0.0855975971, -0.3124062419, -0.3024980724, -0.1660955846, 0.1188771799, 0.3957428336, 0.0464487858, 0.1652832925, 0.141623348, -0.2059976459, -0.248338148, 0.0333892889, 0.115163967, 0.0171486139, 0.1608876735, 0.1793147624, 0.0733210593, 0.2779512107, 0.155892849, -0.0744744167, -0.0549421161, -0.1906138062, -0.2437295169, 0.1428410858, -0.1014105082, 0.2073238045, -0.1902384013, -0.2917288244, 0.1587089747, -0.2286085486, 0.1630495787, 0.2692561448, -0.0584337339, 0.5097594261, -0.1074662954, 0.2579499185, -0.0396137796, 0.3279566467, -0.183143124, 0.0911631808, 0.2839573324, -0.1068137363, -0.0950942561, 0.0866203532, -0.138792783, -0.2092009634, -0.2366230935, 0.3477985859, -0.0584279336, -0.1488166153, -0.0404732414, 0.2657980919, 0.1655935645, 0.4483642876, -0.0675903708, 0.0337993465, 0.1700199693, 0.2013855129, -0.137362048, 0.0610726327, 0.2482621521, 0.0578230061, 0.1259522587, 0.5288023949, 0.4163005948, -0.060954541, -0.1263368726, -0.2910685539, 0.1425028443, 0.1937830001, 0.1487295479, 0.3334578276, 0.0122656208, -0.0583517365, 0.0439712107, 0.1607936919, 0.1520166993, 0.3418110609, 0.02927812, -0.2028437555, 0.0008464457, 0.1873263121, 0.0220550299, -0.6729873419, 0.3362362683, 0.1451907009, -0.2824924588, 0.3987860978, 0.0277418867, 0.3040841818, -0.2217608839, -0.2226591855, -0.1894538105, 0.0515003428, -0.0737109482, -0.2347967178, -0.1169680506, -0.1961245239, -0.3086969852, -0.1200801358, 0.0403750166, 0.1298111528, 0.0409612283, 0.067796886, -0.057139691, -0.1646536887, 0.1864994019, -0.2584421337, 0.2858180404, 0.0312480219, 0.0454406366, -0.0801775157, 0.1768497825, 0.2635410428, -0.0922866687, -0.0588778891, 0.6529514194, -0.0708789527, -0.2127461135, -0.0827962384, 0.0492601097, -0.1479174644, -0.1888011545, -0.0592487641, 0.5324174762, 0.2739832699, 0.1294230521, -0.1248223484, 0.2267606854, -0.2451611012, 0.2631816268, -0.6641116738, 0.3068289161, 0.2461197823, 0.0778737515, -0.1524754018, 0.067432262, -0.1703534126, -0.1933409274, 0.4078930914, 0.3887723386, 0.5386597514, 0.0947168022, 0.0588995554, -0.2939715385, 0.2791741192, -0.2840402126, 0.0861396715, -0.0574958958, 0.2992790937, -0.7319203019, -0.0987627134, 0.2255545706, -0.1211580709, 0.1216319874, 0.2576981485, 0.0417751111, 0.11881008, -0.1557263732, -0.0532567985, 0.3186097443, 0.082505852, -0.1304461211, -0.2680416703, -0.1397156268, 0.181989938, 0.0978386998, -0.3734223247, -0.0446044989, 0.0930456445, 0.0255390778, -0.038303677, -0.2225392759, 0.0113507258, 0.0509980246, 0.2269795984, 0.0419546254, 0.1949174404, -0.0109647913, 0.1166931912, -0.2026651204, -0.0816120803, -0.1552952975, 0.0546444133, -0.2456045896, 0.5321159363, -0.3866824508, 0.5693585873, -0.4407522082, 0.1738171875, 0.2310235351, -0.4541363418, 0.0961408988, -0.0945511237, -0.1327077001, -0.1259730011, 0.0628546402, 0.3869295716, -0.1089816019, 0.1471087784, 0.1429866552, -0.3117976487, 0.3475707471, -0.0603822619, -0.2231803834, -0.0993921012, 0.224429816, 0.1183505505, 0.3281213939, -0.3093107343, -0.0371793881, 0.4952086806, -0.1033607647, 0.2260008007, 0.1840547323, -0.3150682151, 0.0563163161, -0.1813354343, 0.1425452828, 0.0503484085, 0.2422546148, -0.2390479445, -0.4779425263 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
@thomwolf Sure. I'll try downgrading to 3.7 now even though Arrow say they support >=3.5. Linux (Ubuntu 18.04) - Python 3.8 ====================== Package - Version --------------------- certifi 2020.6.20 chardet 3.0.4 click 7.1.2 datasets 1.0.1 dill 0.3.2 fasttext 0.9.2 filelock 3.0.12 future 0.18.2 idna 2.10 joblib 0.16.0 nltk 3.5 numpy 1.19.1 packaging 20.4 pandas 1.1.2 pip 20.0.2 protobuf 3.13.0 pyarrow 1.0.1 pybind11 2.5.0 pyparsing 2.4.7 python-dateutil 2.8.1 pytz 2020.1 regex 2020.7.14 requests 2.24.0 sacremoses 0.0.43 scikit-learn 0.23.2 scipy 1.5.2 sentence-transformers 0.3.6 sentencepiece 0.1.91 setuptools 46.1.3 six 1.15.0 stanza 1.1.1 threadpoolctl 2.1.0 tokenizers 0.8.1rc2 torch 1.6.0+cu101 tqdm 4.48.2 transformers 3.1.0 urllib3 1.25.10 wheel 0.34.2 xxhash 2.0.0 Windows 10 - Python 3.8 ================ Package - Version ---------------------------- certifi 2020.6.20 chardet 3.0.4 click 7.1.2 datasets 1.0.1 dill 0.3.2 fasttext 0.9.2 filelock 3.0.12 future 0.18.2 idna 2.10 joblib 0.16.0 nlp 0.4.0 nltk 3.5 numpy 1.19.1 packaging 20.4 pandas 1.1.1 pip 20.0.2 protobuf 3.13.0 pyarrow 1.0.1 pybind11 2.5.0 pyparsing 2.4.7 python-dateutil 2.8.1 pytz 2020.1 regex 2020.7.14 requests 2.24.0 sacremoses 0.0.43 scikit-learn 0.23.2 scipy 1.5.2 sentence-transformers 0.3.5.1 sentencepiece 0.1.91 setuptools 46.1.3 six 1.15.0 stanza 1.1.1 threadpoolctl 2.1.0 tokenizers 0.8.1rc1 torch 1.6.0+cu101 tqdm 4.48.2 transformers 3.0.2 urllib3 1.25.10 wheel 0.34.2 xxhash 2.0.0
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
194
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` @thomwolf Sure. I'll try downgrading to 3.7 now even though Arrow say they support >=3.5. Linux (Ubuntu 18.04) - Python 3.8 ====================== Package - Version --------------------- certifi 2020.6.20 chardet 3.0.4 click 7.1.2 datasets 1.0.1 dill 0.3.2 fasttext 0.9.2 filelock 3.0.12 future 0.18.2 idna 2.10 joblib 0.16.0 nltk 3.5 numpy 1.19.1 packaging 20.4 pandas 1.1.2 pip 20.0.2 protobuf 3.13.0 pyarrow 1.0.1 pybind11 2.5.0 pyparsing 2.4.7 python-dateutil 2.8.1 pytz 2020.1 regex 2020.7.14 requests 2.24.0 sacremoses 0.0.43 scikit-learn 0.23.2 scipy 1.5.2 sentence-transformers 0.3.6 sentencepiece 0.1.91 setuptools 46.1.3 six 1.15.0 stanza 1.1.1 threadpoolctl 2.1.0 tokenizers 0.8.1rc2 torch 1.6.0+cu101 tqdm 4.48.2 transformers 3.1.0 urllib3 1.25.10 wheel 0.34.2 xxhash 2.0.0 Windows 10 - Python 3.8 ================ Package - Version ---------------------------- certifi 2020.6.20 chardet 3.0.4 click 7.1.2 datasets 1.0.1 dill 0.3.2 fasttext 0.9.2 filelock 3.0.12 future 0.18.2 idna 2.10 joblib 0.16.0 nlp 0.4.0 nltk 3.5 numpy 1.19.1 packaging 20.4 pandas 1.1.1 pip 20.0.2 protobuf 3.13.0 pyarrow 1.0.1 pybind11 2.5.0 pyparsing 2.4.7 python-dateutil 2.8.1 pytz 2020.1 regex 2020.7.14 requests 2.24.0 sacremoses 0.0.43 scikit-learn 0.23.2 scipy 1.5.2 sentence-transformers 0.3.5.1 sentencepiece 0.1.91 setuptools 46.1.3 six 1.15.0 stanza 1.1.1 threadpoolctl 2.1.0 tokenizers 0.8.1rc1 torch 1.6.0+cu101 tqdm 4.48.2 transformers 3.0.2 urllib3 1.25.10 wheel 0.34.2 xxhash 2.0.0
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Downgrading to 3.7 does not help. Here is a dummy text file: ```text Verzekering weigert vaker te betalen Bedrijven van verzekeringen erkennen steeds minder arbeidsongevallen . In 2012 weigerden de bedrijven te betalen voor 21.055 ongevallen op het werk . Dat is 11,8 % van alle ongevallen op het werk . Nog nooit weigerden verzekeraars zoveel zaken . In 2012 hadden 135.118 mensen een ongeval op het werk . Dat zijn elke werkdag 530 mensen . Bij die ongevallen stierven 67 mensen . Bijna 12.000 hebben een handicap na het ongeval . Geen echt arbeidsongeval Bedrijven moeten een verzekering hebben voor hun werknemers . ``` A temporary work around for the "text" type, is ```python dataset = Dataset.from_dict({"text": Path(dataset_f).read_text().splitlines()}) ```
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
120
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Downgrading to 3.7 does not help. Here is a dummy text file: ```text Verzekering weigert vaker te betalen Bedrijven van verzekeringen erkennen steeds minder arbeidsongevallen . In 2012 weigerden de bedrijven te betalen voor 21.055 ongevallen op het werk . Dat is 11,8 % van alle ongevallen op het werk . Nog nooit weigerden verzekeraars zoveel zaken . In 2012 hadden 135.118 mensen een ongeval op het werk . Dat zijn elke werkdag 530 mensen . Bij die ongevallen stierven 67 mensen . Bijna 12.000 hebben een handicap na het ongeval . Geen echt arbeidsongeval Bedrijven moeten een verzekering hebben voor hun werknemers . ``` A temporary work around for the "text" type, is ```python dataset = Dataset.from_dict({"text": Path(dataset_f).read_text().splitlines()}) ```
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
@banunitte Please do not post screenshots in the future but copy-paste your code and the errors. That allows others to copy-and-paste your code and test it. You may also want to provide the Python version that you are using.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
39
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` @banunitte Please do not post screenshots in the future but copy-paste your code and the errors. That allows others to copy-and-paste your code and test it. You may also want to provide the Python version that you are using.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
I have the same problem on Linux of the script crashing with a CSV error. This may be caused by 'CRLF', when changed 'CRLF' to 'LF', the problem solved.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
29
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` I have the same problem on Linux of the script crashing with a CSV error. This may be caused by 'CRLF', when changed 'CRLF' to 'LF', the problem solved.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
I pushed a fix for `pyarrow.lib.ArrowInvalid: CSV parse error`. Let me know if you still have this issue. Not sure about the windows one yet
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
25
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` I pushed a fix for `pyarrow.lib.ArrowInvalid: CSV parse error`. Let me know if you still have this issue. Not sure about the windows one yet
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default): ```python dataset = load_dataset('text', script_version='master', data_files=XXX) ``` We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib).
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
107
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default): ```python dataset = load_dataset('text', script_version='master', data_files=XXX) ``` We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib).
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
![image](https://user-images.githubusercontent.com/36957508/93300760-fa9a8680-f829-11ea-9105-7a6f67ad8373.png) win10, py3.6 ``` from datasets import Features, Value, ClassLabel, load_dataset features = Features({'text': Value('string'), 'ctext': Value('string')}) file_dict = {'train': PATH/'summary.csv'} dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features) ```
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
31
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` ![image](https://user-images.githubusercontent.com/36957508/93300760-fa9a8680-f829-11ea-9105-7a6f67ad8373.png) win10, py3.6 ``` from datasets import Features, Value, ClassLabel, load_dataset features = Features({'text': Value('string'), 'ctext': Value('string')}) file_dict = {'train': PATH/'summary.csv'} dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features) ```
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
```python Traceback` (most recent call last): File "main.py", line 281, in <module> main() File "main.py", line 190, in main train_data, test_data = data_factory( File "main.py", line 129, in data_factory train_data = load_dataset('text', File "/home/me/Downloads/datasets/src/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/me/Downloads/datasets/src/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/me/Downloads/datasets/src/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/me/Downloads/datasets/src/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/me/.local/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/me/.cache/huggingface/modules/datasets_modules/datasets/text/512f465342e4f4cd07a8791428a629c043bb89d55ad7817cbf7fcc649178b014/text.py", line 103, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 617, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 123, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Unfortunately i am still getting this issue on Linux. I installed datasets from source and specified script_version to master.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
135
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` ```python Traceback` (most recent call last): File "main.py", line 281, in <module> main() File "main.py", line 190, in main train_data, test_data = data_factory( File "main.py", line 129, in data_factory train_data = load_dataset('text', File "/home/me/Downloads/datasets/src/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/me/Downloads/datasets/src/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/me/Downloads/datasets/src/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/me/Downloads/datasets/src/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/me/.local/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/me/.cache/huggingface/modules/datasets_modules/datasets/text/512f465342e4f4cd07a8791428a629c043bb89d55ad7817cbf7fcc649178b014/text.py", line 103, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 617, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 123, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Unfortunately i am still getting this issue on Linux. I installed datasets from source and specified script_version to master.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
> ![image](https://user-images.githubusercontent.com/36957508/93300760-fa9a8680-f829-11ea-9105-7a6f67ad8373.png) > win10, py3.6 > > ``` > from datasets import Features, Value, ClassLabel, load_dataset > > > features = Features({'text': Value('string'), 'ctext': Value('string')}) > file_dict = {'train': PATH/'summary.csv'} > > dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features) > ``` Since #644 it should now work on windows @ScottishFold007 > Trying the following snippet, I get different problems on Linux and Windows. > > ```python > dataset = load_dataset("text", data_files="data.txt") > # or > dataset = load_dataset("text", data_files=["data.txt"]) > ``` > > Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: > > ``` > Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. > Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text > Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 > Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py > Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json > Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json > Using custom data configuration default > ``` Same for you @BramVanroy . Not sure about the one on linux though
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
184
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` > ![image](https://user-images.githubusercontent.com/36957508/93300760-fa9a8680-f829-11ea-9105-7a6f67ad8373.png) > win10, py3.6 > > ``` > from datasets import Features, Value, ClassLabel, load_dataset > > > features = Features({'text': Value('string'), 'ctext': Value('string')}) > file_dict = {'train': PATH/'summary.csv'} > > dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features) > ``` Since #644 it should now work on windows @ScottishFold007 > Trying the following snippet, I get different problems on Linux and Windows. > > ```python > dataset = load_dataset("text", data_files="data.txt") > # or > dataset = load_dataset("text", data_files=["data.txt"]) > ``` > > Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: > > ``` > Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. > Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text > Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 > Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py > Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json > Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json > Using custom data configuration default > ``` Same for you @BramVanroy . Not sure about the one on linux though
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
> To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default): > > ```python > dataset = load_dataset('text', script_version='master', data_files=XXX) > ``` > > We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib). Linux here: I was using the 0.4.0 nlp library load_dataset to load a text dataset of 9-10Gb without collapsing the RAM memory. However, today I got the csv error message mentioned in this issue. After installing the new (datasets) library from source and specifying the script_verson = 'master' I'm still having this same error message. Furthermore, I cannot use the dictionary "trick" to load the dataset since the system kills the process due to a RAM out of memory problem. Is there any other solution to this error? Thank you in advance.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
206
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` > To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default): > > ```python > dataset = load_dataset('text', script_version='master', data_files=XXX) > ``` > > We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib). Linux here: I was using the 0.4.0 nlp library load_dataset to load a text dataset of 9-10Gb without collapsing the RAM memory. However, today I got the csv error message mentioned in this issue. After installing the new (datasets) library from source and specifying the script_verson = 'master' I'm still having this same error message. Furthermore, I cannot use the dictionary "trick" to load the dataset since the system kills the process due to a RAM out of memory problem. Is there any other solution to this error? Thank you in advance.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Hi @raruidol To fix the RAM issue you'll need to shard your text files into smaller files (see https://github.com/huggingface/datasets/issues/610#issuecomment-691672919 for example) I'm not sure why you're having the csv error on linux. Do you think you could to to reproduce it on google colab for example ? Or send me a dummy .txt file that reproduces the issue ?
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
59
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Hi @raruidol To fix the RAM issue you'll need to shard your text files into smaller files (see https://github.com/huggingface/datasets/issues/610#issuecomment-691672919 for example) I'm not sure why you're having the csv error on linux. Do you think you could to to reproduce it on google colab for example ? Or send me a dummy .txt file that reproduces the issue ?
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
@lhoestq The crash message shows up when loading the dataset: ``` print('Loading corpus...') files = glob.glob('corpora/shards/*') -> dataset = load_dataset('text', script_version='master', data_files=files) print('Corpus loaded.') ``` And this is the exact message: ``` Traceback (most recent call last): File "run_language_modeling.py", line 27, in <module> dataset = load_dataset('text', script_version='master', data_files=files) File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/builder.py", line 471, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/builder.py", line 548, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/builder.py", line 892, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/jupyter-raruidol/.cache/huggingface/modules/datasets_modules/datasets/text/512f465342e4f4cd07a8791428a629c043bb89d55ad7817cbf7fcc649178b014/text.py", line 107, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` And these are the pip packages I have atm and their versions: ``` Package Version Location --------------- --------- ------------------------------------------------------------- certifi 2020.6.20 chardet 3.0.4 click 7.1.2 datasets 1.0.2 dill 0.3.2 filelock 3.0.12 future 0.18.2 idna 2.10 joblib 0.16.0 numpy 1.19.1 packaging 20.4 pandas 1.1.1 pip 19.0.3 pyarrow 1.0.1 pyparsing 2.4.7 python-dateutil 2.8.1 pytz 2020.1 regex 2020.7.14 requests 2.24.0 sacremoses 0.0.43 sentencepiece 0.1.91 setuptools 40.8.0 six 1.15.0 tokenizers 0.8.1rc2 torch 1.6.0 tqdm 4.48.2 transformers 3.0.2 /home/jupyter-raruidol/DebatAnalyser/env/src/transformers/src ```
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
207
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` @lhoestq The crash message shows up when loading the dataset: ``` print('Loading corpus...') files = glob.glob('corpora/shards/*') -> dataset = load_dataset('text', script_version='master', data_files=files) print('Corpus loaded.') ``` And this is the exact message: ``` Traceback (most recent call last): File "run_language_modeling.py", line 27, in <module> dataset = load_dataset('text', script_version='master', data_files=files) File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset ignore_verifications=ignore_verifications, File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/builder.py", line 471, in download_and_prepare dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/builder.py", line 548, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/datasets/builder.py", line 892, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/jupyter-raruidol/DebatAnalyser/env/lib/python3.7/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/jupyter-raruidol/.cache/huggingface/modules/datasets_modules/datasets/text/512f465342e4f4cd07a8791428a629c043bb89d55ad7817cbf7fcc649178b014/text.py", line 107, in _generate_tables convert_options=self.config.convert_options, File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` And these are the pip packages I have atm and their versions: ``` Package Version Location --------------- --------- ------------------------------------------------------------- certifi 2020.6.20 chardet 3.0.4 click 7.1.2 datasets 1.0.2 dill 0.3.2 filelock 3.0.12 future 0.18.2 idna 2.10 joblib 0.16.0 numpy 1.19.1 packaging 20.4 pandas 1.1.1 pip 19.0.3 pyarrow 1.0.1 pyparsing 2.4.7 python-dateutil 2.8.1 pytz 2020.1 regex 2020.7.14 requests 2.24.0 sacremoses 0.0.43 sentencepiece 0.1.91 setuptools 40.8.0 six 1.15.0 tokenizers 0.8.1rc2 torch 1.6.0 tqdm 4.48.2 transformers 3.0.2 /home/jupyter-raruidol/DebatAnalyser/env/src/transformers/src ```
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
I tested on google colab which is also linux using this code: - first download an arbitrary text file ```bash wget https://raw.githubusercontent.com/abisee/cnn-dailymail/master/url_lists/all_train.txt ``` - then run ```python from datasets import load_dataset d = load_dataset("text", data_files="all_train.txt", script_version='master') ``` And I don't get this issue. \> Could you test on your side if these lines work @raruidol ? also cc @Skyy93 as it seems you have the same issue If it works: It could mean that the issue could come from unexpected patterns in the files you want to use. In that case we should find a way to handle them. And if it doesn't work: It could mean that it comes from the way pyarrow reads text files on linux. In that case we should report it to pyarrow and find a workaround in the meantime Either way it should help to find where this bug comes from and fix it :) Thank you in advance !
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
156
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` I tested on google colab which is also linux using this code: - first download an arbitrary text file ```bash wget https://raw.githubusercontent.com/abisee/cnn-dailymail/master/url_lists/all_train.txt ``` - then run ```python from datasets import load_dataset d = load_dataset("text", data_files="all_train.txt", script_version='master') ``` And I don't get this issue. \> Could you test on your side if these lines work @raruidol ? also cc @Skyy93 as it seems you have the same issue If it works: It could mean that the issue could come from unexpected patterns in the files you want to use. In that case we should find a way to handle them. And if it doesn't work: It could mean that it comes from the way pyarrow reads text files on linux. In that case we should report it to pyarrow and find a workaround in the meantime Either way it should help to find where this bug comes from and fix it :) Thank you in advance !
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Update: also tested the above code in a docker container from [jupyter/minimal-notebook](https://hub.docker.com/r/jupyter/minimal-notebook/) (based on ubuntu) and still not able to reproduce
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
21
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Update: also tested the above code in a docker container from [jupyter/minimal-notebook](https://hub.docker.com/r/jupyter/minimal-notebook/) (based on ubuntu) and still not able to reproduce
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
It looks like with your text input file works without any problem. I have been doing some experiments this morning with my input files and I'm almost certain that the crash is caused by some unexpected pattern in the files. However, I've not been able to spot the main cause of it. What I find strange is that this same corpus was being loaded by the nlp 0.4.0 library without any problem... Where can I find the code where you structure the input text data in order to use it with pyarrow?
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
92
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` It looks like with your text input file works without any problem. I have been doing some experiments this morning with my input files and I'm almost certain that the crash is caused by some unexpected pattern in the files. However, I've not been able to spot the main cause of it. What I find strange is that this same corpus was being loaded by the nlp 0.4.0 library without any problem... Where can I find the code where you structure the input text data in order to use it with pyarrow?
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Under the hood it does ```python import pyarrow as pa import pyarrow.csv # Use csv reader from Pyarrow with one column for text files # To force the one-column setting, we set an arbitrary character # that is not in text files as delimiter, such as \b or \v. # The bell character, \b, was used to make beeps back in the days parse_options = pa.csv.ParseOptions( delimiter="\b", quote_char=False, double_quote=False, escape_char=False, newlines_in_values=False, ignore_empty_lines=False, ) read_options= pa.csv.ReadOptions(use_threads=True, column_names=["text"]) pa_table = pa.csv.read_csv("all_train.txt", read_options=read_options, parse_options=parse_options) ``` Note that we changed the parse options with datasets 1.0 In particular the delimiter used to be `\r` but this delimiter doesn't work on windows.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
107
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Under the hood it does ```python import pyarrow as pa import pyarrow.csv # Use csv reader from Pyarrow with one column for text files # To force the one-column setting, we set an arbitrary character # that is not in text files as delimiter, such as \b or \v. # The bell character, \b, was used to make beeps back in the days parse_options = pa.csv.ParseOptions( delimiter="\b", quote_char=False, double_quote=False, escape_char=False, newlines_in_values=False, ignore_empty_lines=False, ) read_options= pa.csv.ReadOptions(use_threads=True, column_names=["text"]) pa_table = pa.csv.read_csv("all_train.txt", read_options=read_options, parse_options=parse_options) ``` Note that we changed the parse options with datasets 1.0 In particular the delimiter used to be `\r` but this delimiter doesn't work on windows.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Could you try with `\a` instead of `\b` ? It looks like the bell character is \a in python and not \b
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
22
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Could you try with `\a` instead of `\b` ? It looks like the bell character is \a in python and not \b
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
I was just exploring if the crash was happening in every shard or not, and which shards were generating the error message. With \b I got the following list of shards crashing: ``` Errors on files: ['corpora/shards/shard_0069', 'corpora/shards/shard_0043', 'corpora/shards/shard_0014', 'corpora/shards/shard_0032', 'corpora/shards/shard_0088', 'corpora/shards/shard_0018', 'corpora/shards/shard_0073', 'corpora/shards/shard_0079', 'corpora/shards/shard_0038', 'corpora/shards/shard_0041', 'corpora/shards/shard_0007', 'corpora/shards/shard_0004', 'corpora/shards/shard_0102', 'corpora/shards/shard_0096', 'corpora/shards/shard_0030', 'corpora/shards/shard_0076', 'corpora/shards/shard_0067', 'corpora/shards/shard_0052', 'corpora/shards/shard_0026', 'corpora/shards/shard_0024', 'corpora/shards/shard_0064', 'corpora/shards/shard_0044', 'corpora/shards/shard_0013', 'corpora/shards/shard_0062', 'corpora/shards/shard_0057', 'corpora/shards/shard_0097', 'corpora/shards/shard_0094', 'corpora/shards/shard_0078', 'corpora/shards/shard_0075', 'corpora/shards/shard_0039', 'corpora/shards/shard_0077', 'corpora/shards/shard_0021', 'corpora/shards/shard_0040', 'corpora/shards/shard_0009', 'corpora/shards/shard_0023', 'corpora/shards/shard_0095', 'corpora/shards/shard_0107', 'corpora/shards/shard_0063', 'corpora/shards/shard_0086', 'corpora/shards/shard_0047', 'corpora/shards/shard_0089', 'corpora/shards/shard_0037', 'corpora/shards/shard_0101', 'corpora/shards/shard_0093', 'corpora/shards/shard_0082', 'corpora/shards/shard_0091', 'corpora/shards/shard_0065', 'corpora/shards/shard_0020', 'corpora/shards/shard_0070', 'corpora/shards/shard_0008', 'corpora/shards/shard_0058', 'corpora/shards/shard_0060', 'corpora/shards/shard_0022', 'corpora/shards/shard_0059', 'corpora/shards/shard_0100', 'corpora/shards/shard_0027', 'corpora/shards/shard_0072', 'corpora/shards/shard_0098', 'corpora/shards/shard_0019', 'corpora/shards/shard_0066', 'corpora/shards/shard_0042', 'corpora/shards/shard_0053'] ``` I also tried with \a and the list decreased but there were still several crashes: ``` Errors on files: ['corpora/shards/shard_0069', 'corpora/shards/shard_0055', 'corpora/shards/shard_0043', 'corpora/shards/shard_0014', 'corpora/shards/shard_0073', 'corpora/shards/shard_0025', 'corpora/shards/shard_0068', 'corpora/shards/shard_0102', 'corpora/shards/shard_0096', 'corpora/shards/shard_0076', 'corpora/shards/shard_0067', 'corpora/shards/shard_0026', 'corpora/shards/shard_0024', 'corpora/shards/shard_0044', 'corpora/shards/shard_0087', 'corpora/shards/shard_0092', 'corpora/shards/shard_0074', 'corpora/shards/shard_0094', 'corpora/shards/shard_0078', 'corpora/shards/shard_0039', 'corpora/shards/shard_0077', 'corpora/shards/shard_0040', 'corpora/shards/shard_0009', 'corpora/shards/shard_0107', 'corpora/shards/shard_0063', 'corpora/shards/shard_0103', 'corpora/shards/shard_0047', 'corpora/shards/shard_0033', 'corpora/shards/shard_0089', 'corpora/shards/shard_0037', 'corpora/shards/shard_0082', 'corpora/shards/shard_0071', 'corpora/shards/shard_0091', 'corpora/shards/shard_0065', 'corpora/shards/shard_0070', 'corpora/shards/shard_0058', 'corpora/shards/shard_0081', 'corpora/shards/shard_0060', 'corpora/shards/shard_0002', 'corpora/shards/shard_0059', 'corpora/shards/shard_0027', 'corpora/shards/shard_0072', 'corpora/shards/shard_0098', 'corpora/shards/shard_0019', 'corpora/shards/shard_0045', 'corpora/shards/shard_0036', 'corpora/shards/shard_0066', 'corpora/shards/shard_0053'] ``` Which means that it is quite possible that the assumption of that some unexpected pattern in the files is causing the crashes is true. If I am able to reach any conclusion I will post It here asap.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
205
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` I was just exploring if the crash was happening in every shard or not, and which shards were generating the error message. With \b I got the following list of shards crashing: ``` Errors on files: ['corpora/shards/shard_0069', 'corpora/shards/shard_0043', 'corpora/shards/shard_0014', 'corpora/shards/shard_0032', 'corpora/shards/shard_0088', 'corpora/shards/shard_0018', 'corpora/shards/shard_0073', 'corpora/shards/shard_0079', 'corpora/shards/shard_0038', 'corpora/shards/shard_0041', 'corpora/shards/shard_0007', 'corpora/shards/shard_0004', 'corpora/shards/shard_0102', 'corpora/shards/shard_0096', 'corpora/shards/shard_0030', 'corpora/shards/shard_0076', 'corpora/shards/shard_0067', 'corpora/shards/shard_0052', 'corpora/shards/shard_0026', 'corpora/shards/shard_0024', 'corpora/shards/shard_0064', 'corpora/shards/shard_0044', 'corpora/shards/shard_0013', 'corpora/shards/shard_0062', 'corpora/shards/shard_0057', 'corpora/shards/shard_0097', 'corpora/shards/shard_0094', 'corpora/shards/shard_0078', 'corpora/shards/shard_0075', 'corpora/shards/shard_0039', 'corpora/shards/shard_0077', 'corpora/shards/shard_0021', 'corpora/shards/shard_0040', 'corpora/shards/shard_0009', 'corpora/shards/shard_0023', 'corpora/shards/shard_0095', 'corpora/shards/shard_0107', 'corpora/shards/shard_0063', 'corpora/shards/shard_0086', 'corpora/shards/shard_0047', 'corpora/shards/shard_0089', 'corpora/shards/shard_0037', 'corpora/shards/shard_0101', 'corpora/shards/shard_0093', 'corpora/shards/shard_0082', 'corpora/shards/shard_0091', 'corpora/shards/shard_0065', 'corpora/shards/shard_0020', 'corpora/shards/shard_0070', 'corpora/shards/shard_0008', 'corpora/shards/shard_0058', 'corpora/shards/shard_0060', 'corpora/shards/shard_0022', 'corpora/shards/shard_0059', 'corpora/shards/shard_0100', 'corpora/shards/shard_0027', 'corpora/shards/shard_0072', 'corpora/shards/shard_0098', 'corpora/shards/shard_0019', 'corpora/shards/shard_0066', 'corpora/shards/shard_0042', 'corpora/shards/shard_0053'] ``` I also tried with \a and the list decreased but there were still several crashes: ``` Errors on files: ['corpora/shards/shard_0069', 'corpora/shards/shard_0055', 'corpora/shards/shard_0043', 'corpora/shards/shard_0014', 'corpora/shards/shard_0073', 'corpora/shards/shard_0025', 'corpora/shards/shard_0068', 'corpora/shards/shard_0102', 'corpora/shards/shard_0096', 'corpora/shards/shard_0076', 'corpora/shards/shard_0067', 'corpora/shards/shard_0026', 'corpora/shards/shard_0024', 'corpora/shards/shard_0044', 'corpora/shards/shard_0087', 'corpora/shards/shard_0092', 'corpora/shards/shard_0074', 'corpora/shards/shard_0094', 'corpora/shards/shard_0078', 'corpora/shards/shard_0039', 'corpora/shards/shard_0077', 'corpora/shards/shard_0040', 'corpora/shards/shard_0009', 'corpora/shards/shard_0107', 'corpora/shards/shard_0063', 'corpora/shards/shard_0103', 'corpora/shards/shard_0047', 'corpora/shards/shard_0033', 'corpora/shards/shard_0089', 'corpora/shards/shard_0037', 'corpora/shards/shard_0082', 'corpora/shards/shard_0071', 'corpora/shards/shard_0091', 'corpora/shards/shard_0065', 'corpora/shards/shard_0070', 'corpora/shards/shard_0058', 'corpora/shards/shard_0081', 'corpora/shards/shard_0060', 'corpora/shards/shard_0002', 'corpora/shards/shard_0059', 'corpora/shards/shard_0027', 'corpora/shards/shard_0072', 'corpora/shards/shard_0098', 'corpora/shards/shard_0019', 'corpora/shards/shard_0045', 'corpora/shards/shard_0036', 'corpora/shards/shard_0066', 'corpora/shards/shard_0053'] ``` Which means that it is quite possible that the assumption of that some unexpected pattern in the files is causing the crashes is true. If I am able to reach any conclusion I will post It here asap.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Hmmm I was expecting it to work with \a, not sure why they appear in your text files though
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
19
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Hmmm I was expecting it to work with \a, not sure why they appear in your text files though
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Hi @lhoestq, is there any input length restriction which was not before the update of the nlp library?
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
18
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Hi @lhoestq, is there any input length restriction which was not before the update of the nlp library?
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
No we never set any input length restriction on our side (maybe arrow but I don't think so)
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
18
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` No we never set any input length restriction on our side (maybe arrow but I don't think so)
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
@lhoestq Can you ever be certain that a delimiter character is not present in a plain text file? In other formats (e.g. CSV) , rules are set of what is allowed and what isn't so that it actually constitutes a CSV file. In a text file you basically have "anything goes", so I don't think you can ever be entirely sure that the chosen delimiter does not exist in the text file, or am I wrong? If I understand correctly you choose a delimiter that we hope does not exist in the file, so that when the CSV parser starts splitting into columns, it will only ever create one column? Why can't we use a newline character though?
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
118
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` @lhoestq Can you ever be certain that a delimiter character is not present in a plain text file? In other formats (e.g. CSV) , rules are set of what is allowed and what isn't so that it actually constitutes a CSV file. In a text file you basically have "anything goes", so I don't think you can ever be entirely sure that the chosen delimiter does not exist in the text file, or am I wrong? If I understand correctly you choose a delimiter that we hope does not exist in the file, so that when the CSV parser starts splitting into columns, it will only ever create one column? Why can't we use a newline character though?
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
Okay, I have splitted the crashing shards into individual sentences and some examples of the inputs that are causing the crashes are the following ones: _4. DE L’ORGANITZACIÓ ESTAMENTAL A L’ORGANITZACIÓ EN CLASSES A mesura que es desenvolupava un sistema econòmic capitalista i naixia una classe burgesa cada vegada més preparada per a substituir els dirigents de les velles monarquies absolutistes, es qüestionava l’abundància de béns amortitzats, que com s’ha dit estaven fora del mercat i no pagaven tributs, pels perjudicis que ocasionaven a les finances públiques i a l’economia en general. Aquest estat d’opinió revolucionari va desembocar en un conjunt de mesures pràctiques de caràcter liberal. D’una banda, les que intentaven desposseir les mans mortes del domini de béns acumulats, procés que acostumem a denominar desamortització, i que no és més que la nacionalització i venda d’aquests béns eclesiàstics o civils en subhasta pública al millor postor. D’altra banda, les que redimien o reduïen els censos i delmes o aixecaven les prohibicions de venda, és a dir, les vinculacions. La desamortització, que va afectar béns dels ordes religiosos, dels pobles i d’algunes corporacions civils, no va ser un camí fàcil, perquè costava i costa trobar algú que sigui indiferent a la pèrdua de béns, drets i privilegis. I té una gran transcendència, va privar els antics estaments de les Espanyes, clero i pobles —la noblesa en queda al marge—, de la força econòmica que els donaven bona part de les seves terres i, en última instància, va preparar el terreny per a la substitució de la vella societat estamental per la nova societat classista. En aquesta societat, en teoria, les agrupacions socials són obertes, no tenen cap estatut jurídic privilegiat i estan definides per la possessió o no d’uns béns econòmics que són lliurement alienables. A les Espanyes la transformació va afectar poc l’aristocràcia latifundista, allà on n’hi havia. Aquesta situació va afavorir, en part, la persistència de la vella cultura de la societat estamental en determinats ambients, i això ha influït decisivament en la manca de democràcia que caracteritza la majoria de règims polítics que s’han anat succeint. Una manera de pensar que sempre sura en un moment o altre, i que de fet no acaba de desaparèixer del tot. 5. INICI DE LA DESAMORTITZACIÓ A LES ESPANYES Durant el segle xviii, dins d’aquesta visió lliberal, va agafar força en alguns cercles de les Espanyes el corrent d’opinió contrari a les mans mortes. Durant el regnat de Carles III, s’arbitraren les primeres mesures desamortitzadores proposades per alguns ministres il·lustrats. Aquestes disposicions foren modestes i poc eficaces, no van aturar l’acumulació de terres per part dels estaments que constituïen les mans mortes i varen afectar principalment béns dels pobles. L’Església no va ser tocada, excepte en el cas de 110_ _la revolució liberal, perquè, encara que havia perdut els seus drets jurisdiccionals, havia conservat la majoria de terres i fins i tot les havia incrementat amb d’altres que procedien de la desamortització. En la nova situació, les mans mortes del bosc públic eren l’Estat, que no cerca mai l’autofinançament de les despeses de gestió; els diners que manquin ja els posarà l’Estat. 9. DEFENSA I INTENTS DE RECUPERACIÓ DELS BÉNS COMUNALS DESAMORTITZATS El procés de centralització no era senzill, perquè, d’una banda, la nova organització apartava de la gestió moltes corporacions locals i molts veïns que l’havien portada des de l’edat mitjana, i, de l’altra, era difícil de coordinar la nova silvicultura amb moltes pràctiques forestals i drets tradicionals, com la pastura, fer llenya o tallar un arbre aquí i un altre allà quan tenia el gruix suficient, les pràctiques que s’havien fet sempre. Les primeres passes de la nova organització centralitzada varen tenir moltes dificultats en aquells indrets en què els terrenys municipals i comunals tenien un paper important en l’economia local. La desobediència a determinades normes imposades varen prendre formes diferents. Algunes institucions, com, per exemple, la Diputació de Lleida, varen retardar la tramitació d’alguns expedients i varen evitar la venda de béns municipals. Molts pobles permeteren deixar que els veïns continuessin amb les seves pràctiques tradicionals, d’altres varen boicotejar les subhastes d’aprofitaments. L’Estat va reaccionar encomanant a la Guàrdia Civil el compliment de les noves directrius. Imposar el nou règim va costar a l’Administració un grapat d’anys, però de mica en mica, amb molta, molta guarderia i gens de negociació, ho va aconseguir. La nova gestió estatal dels béns municipals va deixar, com hem comentat, molta gent sense uns recursos necessaris per a la supervivència, sobre tot en àrees on predominaven les grans propietats, i on els pagesos sense terra treballaven de jornalers temporers. Això va afavorir que, a bona part de les Espanyes, les primeres lluites camperoles de la segona meitat del segle xix defensessin la recuperació dels comunals desamortitzats; per a molts aquella expropiació i venda dirigida pels governs monàrquics era la causa de molta misèria. D’altres, més radicalitzats, varen entendre que l’eliminació de la propietat col·lectiva i la gestió estatal dels boscos no desamortitzats suposava una usurpació pura i dura. En les zones més afectades per la desamortització això va donar lloc a un imaginari centrat en la defensa del comunal. La Segona República va arribar en una conjuntura econòmica de crisi, generada pel crac del 1929. Al camp, aquesta situació va produir una forta caiguda dels preus dels productes agraris i un increment important de l’atur. QUADERNS AGRARIS 42 (juny 2017), p. 105-126_ I think that the main difference between the crashing samples and the rest is their length. Therefore, couldn't the length be causing the message errors? I hope with these samples you can identify what is causing the crashes considering that the 0.4.0 nlp library was loading them properly.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
949
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` Okay, I have splitted the crashing shards into individual sentences and some examples of the inputs that are causing the crashes are the following ones: _4. DE L’ORGANITZACIÓ ESTAMENTAL A L’ORGANITZACIÓ EN CLASSES A mesura que es desenvolupava un sistema econòmic capitalista i naixia una classe burgesa cada vegada més preparada per a substituir els dirigents de les velles monarquies absolutistes, es qüestionava l’abundància de béns amortitzats, que com s’ha dit estaven fora del mercat i no pagaven tributs, pels perjudicis que ocasionaven a les finances públiques i a l’economia en general. Aquest estat d’opinió revolucionari va desembocar en un conjunt de mesures pràctiques de caràcter liberal. D’una banda, les que intentaven desposseir les mans mortes del domini de béns acumulats, procés que acostumem a denominar desamortització, i que no és més que la nacionalització i venda d’aquests béns eclesiàstics o civils en subhasta pública al millor postor. D’altra banda, les que redimien o reduïen els censos i delmes o aixecaven les prohibicions de venda, és a dir, les vinculacions. La desamortització, que va afectar béns dels ordes religiosos, dels pobles i d’algunes corporacions civils, no va ser un camí fàcil, perquè costava i costa trobar algú que sigui indiferent a la pèrdua de béns, drets i privilegis. I té una gran transcendència, va privar els antics estaments de les Espanyes, clero i pobles —la noblesa en queda al marge—, de la força econòmica que els donaven bona part de les seves terres i, en última instància, va preparar el terreny per a la substitució de la vella societat estamental per la nova societat classista. En aquesta societat, en teoria, les agrupacions socials són obertes, no tenen cap estatut jurídic privilegiat i estan definides per la possessió o no d’uns béns econòmics que són lliurement alienables. A les Espanyes la transformació va afectar poc l’aristocràcia latifundista, allà on n’hi havia. Aquesta situació va afavorir, en part, la persistència de la vella cultura de la societat estamental en determinats ambients, i això ha influït decisivament en la manca de democràcia que caracteritza la majoria de règims polítics que s’han anat succeint. Una manera de pensar que sempre sura en un moment o altre, i que de fet no acaba de desaparèixer del tot. 5. INICI DE LA DESAMORTITZACIÓ A LES ESPANYES Durant el segle xviii, dins d’aquesta visió lliberal, va agafar força en alguns cercles de les Espanyes el corrent d’opinió contrari a les mans mortes. Durant el regnat de Carles III, s’arbitraren les primeres mesures desamortitzadores proposades per alguns ministres il·lustrats. Aquestes disposicions foren modestes i poc eficaces, no van aturar l’acumulació de terres per part dels estaments que constituïen les mans mortes i varen afectar principalment béns dels pobles. L’Església no va ser tocada, excepte en el cas de 110_ _la revolució liberal, perquè, encara que havia perdut els seus drets jurisdiccionals, havia conservat la majoria de terres i fins i tot les havia incrementat amb d’altres que procedien de la desamortització. En la nova situació, les mans mortes del bosc públic eren l’Estat, que no cerca mai l’autofinançament de les despeses de gestió; els diners que manquin ja els posarà l’Estat. 9. DEFENSA I INTENTS DE RECUPERACIÓ DELS BÉNS COMUNALS DESAMORTITZATS El procés de centralització no era senzill, perquè, d’una banda, la nova organització apartava de la gestió moltes corporacions locals i molts veïns que l’havien portada des de l’edat mitjana, i, de l’altra, era difícil de coordinar la nova silvicultura amb moltes pràctiques forestals i drets tradicionals, com la pastura, fer llenya o tallar un arbre aquí i un altre allà quan tenia el gruix suficient, les pràctiques que s’havien fet sempre. Les primeres passes de la nova organització centralitzada varen tenir moltes dificultats en aquells indrets en què els terrenys municipals i comunals tenien un paper important en l’economia local. La desobediència a determinades normes imposades varen prendre formes diferents. Algunes institucions, com, per exemple, la Diputació de Lleida, varen retardar la tramitació d’alguns expedients i varen evitar la venda de béns municipals. Molts pobles permeteren deixar que els veïns continuessin amb les seves pràctiques tradicionals, d’altres varen boicotejar les subhastes d’aprofitaments. L’Estat va reaccionar encomanant a la Guàrdia Civil el compliment de les noves directrius. Imposar el nou règim va costar a l’Administració un grapat d’anys, però de mica en mica, amb molta, molta guarderia i gens de negociació, ho va aconseguir. La nova gestió estatal dels béns municipals va deixar, com hem comentat, molta gent sense uns recursos necessaris per a la supervivència, sobre tot en àrees on predominaven les grans propietats, i on els pagesos sense terra treballaven de jornalers temporers. Això va afavorir que, a bona part de les Espanyes, les primeres lluites camperoles de la segona meitat del segle xix defensessin la recuperació dels comunals desamortitzats; per a molts aquella expropiació i venda dirigida pels governs monàrquics era la causa de molta misèria. D’altres, més radicalitzats, varen entendre que l’eliminació de la propietat col·lectiva i la gestió estatal dels boscos no desamortitzats suposava una usurpació pura i dura. En les zones més afectades per la desamortització això va donar lloc a un imaginari centrat en la defensa del comunal. La Segona República va arribar en una conjuntura econòmica de crisi, generada pel crac del 1929. Al camp, aquesta situació va produir una forta caiguda dels preus dels productes agraris i un increment important de l’atur. QUADERNS AGRARIS 42 (juny 2017), p. 105-126_ I think that the main difference between the crashing samples and the rest is their length. Therefore, couldn't the length be causing the message errors? I hope with these samples you can identify what is causing the crashes considering that the 0.4.0 nlp library was loading them properly.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
So we're using the csv reader to read text files because arrow doesn't have a text reader. To workaround the fact that text files are just csv with one column, we want to set a delimiter that doesn't appear in text files. Until now I thought that it would do the job but unfortunately it looks like even characters like \a appear in text files. So we have to option: - find another delimiter that does the job (maybe `\x1b` esc or `\x18` cancel) - don't use the csv reader from arrow but the text reader from pandas instead (or any other reader). The only important thing is that it must be fast (arrow's reader has a nice and fast multithreaded for csv that we're using now but hopefully we can find an alternative) > @lhoestq Can you ever be certain that a delimiter character is not present in a plain text file? In other formats (e.g. CSV) , rules are set of what is allowed and what isn't so that it actually constitutes a CSV file. In a text file you basically have "anything goes", so I don't think you can ever be entirely sure that the chosen delimiter does not exist in the text file, or am I wrong? As long as the text file follows some encoding it wouldn't make sense to have characters such as the bell character. However I agree it can happen. > If I understand correctly you choose a delimiter that we hope does not exist in the file, so that when the CSV parser starts splitting into columns, it will only ever create one column? Why can't we use a newline character though? Exactly. Arrow doesn't allow the newline character unfortunately.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
289
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` So we're using the csv reader to read text files because arrow doesn't have a text reader. To workaround the fact that text files are just csv with one column, we want to set a delimiter that doesn't appear in text files. Until now I thought that it would do the job but unfortunately it looks like even characters like \a appear in text files. So we have to option: - find another delimiter that does the job (maybe `\x1b` esc or `\x18` cancel) - don't use the csv reader from arrow but the text reader from pandas instead (or any other reader). The only important thing is that it must be fast (arrow's reader has a nice and fast multithreaded for csv that we're using now but hopefully we can find an alternative) > @lhoestq Can you ever be certain that a delimiter character is not present in a plain text file? In other formats (e.g. CSV) , rules are set of what is allowed and what isn't so that it actually constitutes a CSV file. In a text file you basically have "anything goes", so I don't think you can ever be entirely sure that the chosen delimiter does not exist in the text file, or am I wrong? As long as the text file follows some encoding it wouldn't make sense to have characters such as the bell character. However I agree it can happen. > If I understand correctly you choose a delimiter that we hope does not exist in the file, so that when the CSV parser starts splitting into columns, it will only ever create one column? Why can't we use a newline character though? Exactly. Arrow doesn't allow the newline character unfortunately.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
> Okay, I have splitted the crashing shards into individual sentences and some examples of the inputs that are causing the crashes are the following ones Thanks for digging into it ! Characters like \a or \b are not shown when printing the text, so as it is I can't tell if it contains unexpected characters. Maybe could could open the file in python and check if `"\b" in open("path/to/file", "r").read()` ? > I think that the main difference between the crashing samples and the rest is their length. Therefore, couldn't the length be causing the message errors? I hope with these samples you can identify what is causing the crashes considering that the 0.4.0 nlp library was loading them properly. To check that you could try to run ```python import pyarrow as pa import pyarrow.csv open("dummy.txt", "w").write((("a" * 10_000) + "\n") * 4) # 4 lines of 10 000 'a' parse_options = pa.csv.ParseOptions( delimiter="\b", quote_char=False, double_quote=False, escape_char=False, newlines_in_values=False, ignore_empty_lines=False, ) read_options= pa.csv.ReadOptions(use_threads=True, column_names=["text"]) pa_table = pa.csv.read_csv("dummy.txt", read_options=read_options, parse_options=parse_options) ``` on my side it runs without error though
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
178
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` > Okay, I have splitted the crashing shards into individual sentences and some examples of the inputs that are causing the crashes are the following ones Thanks for digging into it ! Characters like \a or \b are not shown when printing the text, so as it is I can't tell if it contains unexpected characters. Maybe could could open the file in python and check if `"\b" in open("path/to/file", "r").read()` ? > I think that the main difference between the crashing samples and the rest is their length. Therefore, couldn't the length be causing the message errors? I hope with these samples you can identify what is causing the crashes considering that the 0.4.0 nlp library was loading them properly. To check that you could try to run ```python import pyarrow as pa import pyarrow.csv open("dummy.txt", "w").write((("a" * 10_000) + "\n") * 4) # 4 lines of 10 000 'a' parse_options = pa.csv.ParseOptions( delimiter="\b", quote_char=False, double_quote=False, escape_char=False, newlines_in_values=False, ignore_empty_lines=False, ) read_options= pa.csv.ReadOptions(use_threads=True, column_names=["text"]) pa_table = pa.csv.read_csv("dummy.txt", read_options=read_options, parse_options=parse_options) ``` on my side it runs without error though
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
That's true, It was my error printing the text that way. Maybe as a workaround, I can force all my input samples to have "\b" at the end?
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
28
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` That's true, It was my error printing the text that way. Maybe as a workaround, I can force all my input samples to have "\b" at the end?
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/622
load_dataset for text files not working
> That's true, It was my error printing the text that way. Maybe as a workaround, I can force all my input samples to have "\b" at the end? I don't think it would work since we only want one column, and "\b" is set to be the delimiter between two columns, so it will raise the same issue again. Pyarrow would think that there is more than one column if the delimiter is found somewhere. Anyway, I I'll work on a new text reader if we don't find the right workaround about this delimiter issue.
Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ```
96
load_dataset for text files not working Trying the following snippet, I get different problems on Linux and Windows. ```python dataset = load_dataset("text", data_files="data.txt") # or dataset = load_dataset("text", data_files=["data.txt"]) ``` (ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.) The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file. Linux stack trace: ``` PyTorch version 1.6.0+cu101 available. Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json Using custom data configuration default Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7) Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7... Dataset not on Hf google storage. Downloading and preparing it from source Downloading took 0.0 min Checksum Computation took 0.0 min Unable to verify checksums. Generating split train Traceback (most recent call last): File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data dataset = load_dataset("text", data_files=dataset_f) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset builder_instance.download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare self._download_and_prepare( File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose): File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__ for obj in iterable: File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables pa_table = pac.read_csv( File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2 ``` Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message: ``` Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports. Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7 Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json Using custom data configuration default ``` > That's true, It was my error printing the text that way. Maybe as a workaround, I can force all my input samples to have "\b" at the end? I don't think it would work since we only want one column, and "\b" is set to be the delimiter between two columns, so it will raise the same issue again. Pyarrow would think that there is more than one column if the delimiter is found somewhere. Anyway, I I'll work on a new text reader if we don't find the right workaround about this delimiter issue.
[ -0.2746653557, -0.4020572305, 0.0175604671, 0.3872526288, 0.2696422935, -0.0386611708, 0.3188883066, -0.0543564558, 0.4263593853, -0.0580489412, 0.0659723133, 0.1455249637, -0.155762881, 0.2742005587, 0.0635563657, -0.0350760669, 0.1571834832, -0.0138411364, -0.2914434075, 0.0402487032, -0.1144545451, 0.343121022, -0.2153362632, -0.1469299942, -0.4160704017, 0.2740045488, -0.1050164923, 0.4538784325, -0.0742615759, -0.2378565818, 0.2710004151, 0.1282078922, 0.1639644504, 0.6136500835, -0.0001269617, 0.1100324169, 0.2756477892, -0.1610111743, -0.2998276651, -0.5695472956, 0.1585152, -0.229436785, 0.2088484466, -0.0287808347, 0.1301923692, -0.0045287646, 0.1527261734, -0.3340620399, 0.3551646769, 0.3254781365, 0.1009778604, 0.319337219, 0.0620951056, -0.0146585116, 0.0609621592, 0.4765506983, -0.0917446539, 0.3906491995, 0.3137859106, -0.1942871809, 0.1169525459, -0.0824010223, -0.173093468, -0.1696535349, 0.3285272121, 0.2871707976, -0.6134483814, -0.2057266533, 0.0768415108, 0.185991928, 0.4352323413, -0.4339181483, -0.2217483073, -0.1591290236, -0.0756907016, -0.1254787445, 0.4388753772, 0.1783993691, -0.1985729933, 0.0581207201, -0.2503564358, -0.0692395419, -0.1769829541, 0.3230662346, -0.0084304372, 0.0508893766, -0.2191822082, 0.1040093973, 0.3328262568, -0.070938468, -0.2063758522, -0.2793429792, -0.0293536577, 0.0611275807, -0.2661674321, 0.155729264, -0.265876472, -0.024527017, 0.1117541417, 0.1747619659, -0.0047683977, 0.1417202204, 0.0951443911, 0.230606854, 0.200786978, 0.0978598744, 0.4081540108, 0.0843546987, 0.2615751028, 0.0263589174, -0.0160578992, -0.0952473581, -0.1963426769, -0.5441907048, -0.0697907954, -0.2300525606, 0.4797005355, -0.2050436884, -0.1790353507, -0.0498552509, -0.0808123723, -0.045593895, 0.2161370665, 0.6197093129, -0.0843394548, 0.0338774733, 0.1204906031, 0.3182839751, -0.1168017238, 0.1911227107, 0.0475795567, -0.060427092, -0.0889259726, 0.1795251817, 0.5387114286, -0.3721970618, 0.3424325585, 0.199688971, 0.4671032131, -0.190528512, -0.1514503658, -0.186548546, -0.017401034, 0.188694641, 0.0076277675, 0.0419397131, 0.2405286878, -0.1590053886, -0.1147046387, 0.0940076262, -0.2652541101, -0.0938473344, 0.0322777964, 0.044843629, -0.0952583104, -0.233017683, -0.3073215783, 0.0929252654, 0.0373642743, -0.1054285988, 0.0938849375, -0.1803103387, -0.2380832732, -0.1588564217, 0.2716285884, 0.6603156328, -0.2988540828, -0.1454445124, 0.3255427778, -0.1225561351, -0.1192729101, 0.2550256252, -0.0943286419, 0.0099469628, -0.2610239089, 0.1993144602, 0.1874887198, -0.4092431664, -0.1465578824, 0.3963533342, 0.0584074594, 0.1357301176, 0.2080580443, 0.061810948, 0.0415839031, 0.0460109673, 0.2806777358, 0.00830625, 0.1047211587, -0.0915358663, -0.0034153617, -0.2037544847, 0.0910755023, 0.3670079708, -0.2113380879, 0.0550339371, 0.1075051725, -0.1117833555, 0.1765405238, -0.1039661393, -0.0344483666, 0.5095409751, 0.136237517, 0.320145607, 0.0793996975, -0.2116695493, -0.5979293585, 0.1366195083, 0.2275739461, -0.0535319671, -0.2638649046, -0.0957267359, -0.1770205796, 0.0601341799, -0.2095397115, -0.0141126467, -0.0720958635, 0.153323099, 0.2246877104, 0.0292829312, -0.2047466934, 0.4062137604, -0.1693809479, 0.2454879284, -0.2644483745, 0.1788316816, -0.0356656164, -0.2023014873, -0.0517956205, 0.1018910557, -0.0046758237, -0.2937568426, 0.0954740942, 0.4632970989, 0.0546922497, 0.0856848881, -0.1847891361, -0.0953089744, 0.2269649804, -0.0808335841, -0.0273766853, 0.2919703126, 0.202634871, -0.1917806715, -0.2744133174, 0.1912698895, -0.3355847597, 0.1634297371, 0.0298719797, -0.1083327755, -0.0484333262, 0.1079697758, -0.3023560941, -0.0635971054, 0.4508518279, -0.245456174, 0.2605039477, 0.0018220566, -0.4244133532, -0.2174917758, 0.4196652174, -0.0460520014, 0.1226553023, 0.1877403855, -0.2147008628, 0.2120126188, -0.0877681226, -0.0419767201, 0.5764293671, 0.1378011107, -0.2983499467, 0.2298148274, -0.1166209504, -0.2212796956, 0.28909567, -0.0472779162, -0.0982486308, 0.0960120261, -0.199883163, 0.0083257509, -0.2600296438, -0.0678928122, -0.1015431434, 0.0715262443, -0.4127508402, 0.2223608345, -0.3261347711, -0.1620811522, -0.3533616066, 0.1199704707, -0.2934473157, -0.0352529958, -0.2882409096, 0.2256355137, 0.1631827354, 0.0368443131, -0.0255982298, 0.0039329538, 0.1004285961, -0.5494058728, -0.1985675842, 0.0081634931, -0.2308938205, -0.09342397, 0.3823768795, 0.0441116951, 0.2374776304, -0.3961960673, -0.1094293743, -0.0985936373, -0.1599085331, 0.0557672456, -0.0614240468, 0.1960316002, 0.0531647019, 0.2280195653, -0.1237519458, -0.1310473084, 0.429997921, -0.0381335206, -0.1885627806, 0.2453441471, 0.418446362, -0.3097182214, -0.2610920668, -0.3623774052, -0.127926752, -0.2842012942, 0.3581481874, 0.1559182256, -0.0295688529, 0.502407074, 0.4287555516, 0.1569623649, -0.1803518683, 0.2165795267, 0.0652969927, -0.1683053374, 0.47165066, -0.1643847972, -0.6319024563, 0.077560544, 0.4496122301, -0.2843746543, 0.2175412327, -0.4422396421, -0.062080726, -0.1192546636, 0.0920901597, 0.0410848148, 0.3046549261, 0.1864619553, 0.0804128051, 0.0956785455, -0.0544943623, -0.3214206994, 0.115875788, -0.2110431939, 0.0333539583, 0.2350960672, 0.3713713288, -0.2012350559, 0.4552716613, 0.3391943872, -0.0664088354, 0.2473823279, -0.5043381453, 0.5094944239, -0.164039731, -0.5347825885, 0.0561732873, -0.2177343667, 0.175039351, 0.2766553164, 0.1536438912, 0.3985489309, -0.3371796012, 0.1042308211, -0.0745858252, -0.1997735202, 0.2598342299, -0.1172346398, 0.07948073, -0.1508024037, 0.1711597741, 0.1823587716, -0.2328863293, 0.0390385091, 0.606995225, -0.187331304, 0.0515492372, -0.3987098634, 0.0692128241, -0.3697611392, 0.3847953379, -0.0440685302, 0.3335778117, -0.272993952, -0.1051142141, 0.0177628752, -0.0372728966, 0.5544435382, 0.3075833023, -0.1952400208, 0.017645264, -0.2582425177, -0.3879303336, 0.0970627815, -0.2831110358, 0.3912252784, 0.1797812283, 0.6442822814, -0.3002552092, -0.2145059258, -0.0911262631, 0.4764975011, -0.0228323266, -0.3114879727, -0.2785251141, -0.1634370834, -0.326264888, -0.2423544824, 0.024188133, 0.2216681689, -0.1815151572, 0.2211253345, -0.0578098409, -0.1648263037, 0.2988139987, -0.0309880376, 0.2692631781, -0.3283639252, 0.2320740372, 0.1062322408, 0.4693133235, 0.2969630063, 0.5515258312, -0.0897573903, -0.4601888955, 0.0208050348, -0.158192426, 0.3489817083, 0.1660985798, -0.271594286, 0.1426502168, 0.2977320552, 0.1101862937, -0.4385162294, -0.0669692904, 0.5130982399, 0.2113117725, -0.297188282, -0.4682973325, 0.3646911383, 0.0281750895, 0.1499664485, 0.2716009617, 0.174386844, -0.2929802835, 0.0181154124, -0.3032903671, 0.8145563602, -0.1351298243, 0.4673897922, 0.234522149, -0.0871990025, 0.3978255987, -0.0533245541, 0.0656359866, -0.290350318, -0.0147632677, -0.0129349427, -0.1748355031, 0.4434724748, 0.1701348275, -0.4242369235, 0.2192278653, -0.0133850267, 0.3101128638, -0.2710385919, 0.1851523668, -0.4233768284, -0.3067676425, -0.3461348116, 0.031410303, 0.1470375806, 0.3159359694, -0.0193049833, 0.0686778501, -0.1788801402, -0.2796393931, -0.3666653931, 0.0574042462, -0.3217289448, 0.0584383011, 0.2108016312, -0.3453939557, 0.3396156728, 0.4470134676, 0.2227249444, 0.1258748174, -0.1699061096, -0.0880350247, -0.2285286486, -0.1075689271, 0.0017926008, -0.2334613055, 0.0256198123, 0.0866710916, -0.2706851661, -0.0342283808, -0.0761411712, -0.1780479103, -0.0112767788, 0.1302928329, -0.3514163494, -0.4001736939, -0.44437778, -0.1643960923, 0.1622946262, -0.0622147135, 0.0125065008, 0.1251550168, 0.1535156071, 0.0424739756, 0.0863077492, -0.1513927877, -0.1063950658, 0.380828023, -0.4325574934, -0.243559435, 0.6115919352, 0.4478029013, -0.1363860965, -0.2047025263, 0.3153442442, -0.0241040085, -0.4706379175, 0.060029041, 0.3476565778, 0.0469819792, 0.0210850798, 0.275324285, 0.0409546569, -0.172146678, 0.1079835445, -0.5703998804, -0.3437371254, 0.1958445758, 0.2991572022, 0.1324543804, 0.2247097492, -0.1516838074, -0.014461603, -0.2124669105, -0.1799511015, 0.0283626504, 0.0711824149, -0.2090126425, 0.4280434251, 0.081355378, 0.344661504, -0.242889896, 0.01801694, -0.0082557322, 0.0614189692, -0.0559107885, -0.1323171407, 0.1357380003, -0.0764976963, -0.1801904589, -0.169544518, -0.3009042144, -0.0054443744, -0.3061546683, 0.1830038875, 0.4905683696, -0.1322170496, 0.1660419106, -0.2308710814, 0.2402744442, -0.329467833, 0.2159643024, -0.3301631212, 0.3099443614, 0.1199944466, 0.0645244196, -0.0035627168, 0.0762152299, -0.1796472669, 0.2804463208, 0.1938066781, -0.0876489058, 0.2333928198, -0.4173036814, 0.1791361123, -0.1308644712, 0.4586463571, 0.641823411, -0.2389523089, 0.1770925373, 0.3237511516, 0.0375071131, -0.1066855416, 0.0253850091, 0.1342614591, -0.0756321549, 0.0557793826, 0.2839002311, -0.1099475622, -0.0767710134, 0.0140855024, 0.0420108885, 0.3017364144, 0.1350492239, 0.0422458351, 0.3179255426, 0.2821859717, 0.2172949761, -0.0789582953, 0.3243649006, 0.1688094288, 0.3248777986, -0.127024442, 0.1264023781, -0.1879326552, 0.3269270062, -0.0585653856, -0.331607759, 0.1236126646, 0.0540442131, -0.2286891788, 0.038812235, -0.2160565555, 0.5491749644, -0.5157110691, -0.0090489825, -0.1283325553, 0.0684651956, -0.0507387929, -0.315740943, 0.0320399143, -0.238046214, -0.031142693, 0.0246612411, -0.0586086139, -0.1354765892, 0.0637515709, 0.1260186285, -0.0337767974, -0.3310149014, 0.1216676906, 0.0174298733, 0.0148994373, 0.0049085347, 0.2710103393, 0.1519322693, 0.2196569443, 0.3230521679, 0.3475778997, 0.5777654052, 0.4073307812, 0.1060493812, 0.247576192, -0.2693926692, -0.0126065025, -0.0394145362, 0.3580522239, 0.1128150672, 0.0378051549, 0.2164453715, 0.071313262, -0.0373925306, -0.0545144193, 0.0653119609, -0.1178252771, -0.2989546359, 0.232823208, -0.2536527514, -0.1291730702, -0.1700772196, -0.0467462055, -0.4412434101, -0.038838882, 0.5237542987, 0.2658580244, 0.1927790791, -0.0427043177, 0.0265393183, 0.3400236964, 0.4671335816, 0.3830899, 0.2377200127, -0.0570629947, -0.0111458888, -0.6012919545, -0.011561688, 0.0097208424, -0.1373759061, -0.2386873662, -0.1536646187, 0.1978024244, 0.1551499963, 0.0523218513, -0.1281726658, 0.2108154297, -0.0120303826, -0.0534491763, -0.1669251919, -0.0151777631, 0.1381874084, 0.0049076383, -0.3023660779, 0.0613833815, -0.1089835688, -0.0564864613, -0.3146944046, 0.4238257706, -0.1058529541, -0.3355436921, 0.1364648193, -0.0730646923, 0.4701800346, 0.0425092913, -0.1654963344, -0.1798642278, -0.2382648438, 0.0213490669, 0.4302532673, 0.1545348167, 0.0050934809, -0.4908641577, -0.4926250875, -0.2662900686, 0.2439433932, -0.0592637658, -0.3730337024, 0.0246139765, -0.0186505672, -0.0354575738, 0.0011531644, 0.2333130091, 0.4785370231, -0.2721092105, 0.0106195258, -0.1478198171, -0.127811864, 0.3023913205, -0.4510453641, -0.266930759, 0.030796865, 0.0089577017, 0.0157017279, 0.0496491194, -0.5663858056, 0.1250871271, 0.1359769553, -0.1033064947, -0.1399745792, 0.0530341379, -0.1825750172, -0.03638364, -0.1389523149, 0.4549027979, 0.0883838907, -0.2588396966, 0.0973682255, -0.2056959867 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
It seems that I ran into the same problem ``` def tokenize(cols, example): for in_col, out_col in cols.items(): example[out_col] = hf_tokenizer.convert_tokens_to_ids(hf_tokenizer.tokenize(example[in_col])) return example cola = datasets.load_dataset('glue', 'cola') tokenized_cola = cola.map(partial(tokenize, {'sentence': 'text_idxs'}), num_proc=2,) ``` and it outpus (exceprts) ``` Concatenating 2 shards from multiprocessing Set __getitem__(key) output type to python objects for ['idx', 'label', 'sentence', 'text_idxs'] columns (when key is int or slice) and don't output other (un-formatted) columns. Testing the mapped function outputs Testing finished, running the mapping function on the dataset Done writing 532 indices in 4256 bytes . Done writing 531 indices in 4248 bytes . Process #0 will write at /home/yisiang/.cache/huggingface/datasets/glue/cola/1.0.0/930e9d141872db65102cabb9fa8ac01c11ffc8a1b72c2e364d8cdda4610df542/tokenized_test_00000_of_00002.arrow Process #1 will write at /home/yisiang/.cache/huggingface/datasets/glue/cola/1.0.0/930e9d141872db65102cabb9fa8ac01c11ffc8a1b72c2e364d8cdda4610df542/tokenized_test_00001_of_00002.arrow Spawning 2 processes ``` and then the program never stop.
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
121
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` It seems that I ran into the same problem ``` def tokenize(cols, example): for in_col, out_col in cols.items(): example[out_col] = hf_tokenizer.convert_tokens_to_ids(hf_tokenizer.tokenize(example[in_col])) return example cola = datasets.load_dataset('glue', 'cola') tokenized_cola = cola.map(partial(tokenize, {'sentence': 'text_idxs'}), num_proc=2,) ``` and it outpus (exceprts) ``` Concatenating 2 shards from multiprocessing Set __getitem__(key) output type to python objects for ['idx', 'label', 'sentence', 'text_idxs'] columns (when key is int or slice) and don't output other (un-formatted) columns. Testing the mapped function outputs Testing finished, running the mapping function on the dataset Done writing 532 indices in 4256 bytes . Done writing 531 indices in 4248 bytes . Process #0 will write at /home/yisiang/.cache/huggingface/datasets/glue/cola/1.0.0/930e9d141872db65102cabb9fa8ac01c11ffc8a1b72c2e364d8cdda4610df542/tokenized_test_00000_of_00002.arrow Process #1 will write at /home/yisiang/.cache/huggingface/datasets/glue/cola/1.0.0/930e9d141872db65102cabb9fa8ac01c11ffc8a1b72c2e364d8cdda4610df542/tokenized_test_00001_of_00002.arrow Spawning 2 processes ``` and then the program never stop.
[ -0.4042772651, -0.076164633, 0.0068099909, 0.1466705948, 0.1475023031, -0.189604491, 0.322409153, 0.3429277539, 0.1341746151, 0.1369511783, 0.0367481448, 0.3943180442, -0.4054726958, 0.310338825, -0.3056830764, 0.0618968271, 0.1283406019, -0.0522315875, -0.2669126093, 0.15780209, -0.2797972262, 0.2109820247, -0.3103198111, 0.2153623998, -0.5755157471, 0.059077464, -0.0540032387, 0.2517111599, 0.0042296969, -0.5668841004, 0.3097840846, 0.3128775656, 0.0841087997, 0.4231204391, -0.0001253461, 0.1279417723, 0.3116937578, -0.1059477106, -0.0364290886, -0.3833856285, -0.0744349286, -0.2384932041, 0.232160151, 0.1469332725, 0.2514843643, -0.0637059659, -0.1770323813, -0.1964329481, 0.1855878979, 0.3598253429, 0.079864271, 0.2393259108, 0.2558634579, 0.1061850265, 0.0308735203, 0.1623832881, -0.0530021302, -0.0189513918, 0.2539156377, -0.4286128879, -0.0830042511, 0.2592657804, -0.2532216012, -0.2118039429, -0.1340045035, -0.2208435833, 0.5308258533, -0.5402562022, 0.2115585208, 0.0486419238, -0.2676084936, -0.0402106121, -0.4429703057, -0.1768540889, -0.2546717525, -0.5399872065, 0.17096062, 0.0307246726, -0.1698826253, 0.1184878275, -0.439245075, -0.2035620064, 0.007896157, -0.0298825037, -0.1458258778, 0.647739172, 0.2138984799, 0.3055249751, 0.1323189437, 0.1305703819, 0.183841601, -0.0163388532, -0.0709623396, 0.2070083469, -0.430493623, 0.0555329174, 0.0561707169, -0.2127605975, -0.1796368361, -0.0278098136, -0.2530761063, 0.1307650208, -0.1172354966, 0.0927314386, 0.4056193233, -0.09623117, 0.167709738, 0.3280443251, 0.2209370434, -0.1989021897, -0.0220490154, 0.011740705, 0.2665809691, -0.0622575842, -0.0979442522, 0.2686052322, 0.0859604776, -0.1967092454, -0.2017096728, 0.1901548207, -0.1704504788, -0.1557847112, 0.076308161, 0.2368407249, 0.0790319964, 0.7875009179, 0.105400987, 0.2169736028, -0.3290952146, -0.1062660292, -0.069048956, -0.0170264151, -0.3850458562, 0.1155860797, 0.211610496, 0.1460442543, -0.030364966, 0.034713421, -0.3158588707, -0.254047066, 0.2134022117, -0.3203780949, 0.1630387157, 0.6764132977, -0.0766723678, 0.0704785436, 0.0608326308, -0.2051452249, 0.0493657887, 0.1968806088, -0.5280681849, -0.173972562, -0.2313924134, 0.0630152822, 0.0921195447, 0.2983644307, -0.1968150586, 0.2527911961, 0.3752554059, -0.2726261914, -0.2939333618, -0.4000749886, -0.3631499112, -0.2814879119, -0.0012882561, 0.2978388071, -0.4101811945, -0.0337188877, 0.1389254928, -0.1741316319, 0.3642456532, 0.2580122054, -0.0363181978, 0.0802294165, -0.1671096981, 0.175113678, 0.1112989485, -0.2420789599, -0.0535119772, 0.275108844, 0.0924493521, 0.3352851272, -0.0884901658, -0.3326948583, 0.3726422787, -0.139729917, 0.2458259612, -0.0516837649, -0.1721582115, 0.0256981552, -0.4304660857, -0.0167047121, -0.0738440454, -0.1338190734, 0.4579970837, 0.2050948143, -0.1281722784, -0.4877860248, 0.3257189095, -0.1268088967, 0.3116860688, 0.0617730655, 0.1279978156, 0.1767356098, 0.1328582764, -0.2497059852, -0.3686507344, 0.138436839, -0.2625175118, 0.0193944257, -0.0266867168, -0.0783314779, 0.0837066099, 0.2017332613, -0.2120803595, -0.215004012, 0.0355653316, 0.0074171913, -0.361563921, -0.0625978336, -0.1797470301, 0.6259477735, 0.0919978172, 0.1794137955, 0.0131104812, 0.2692206502, -0.119847104, -0.4355105758, -0.2855911553, 0.307508409, 0.0316627957, -0.0748289526, -0.2006154358, 0.4490845799, 0.5101368427, -0.1541983336, -0.0260392763, 0.1566488892, 0.2412420213, -0.1208864003, -0.1833622903, 0.0375625528, 0.065428786, -0.1723885536, 0.3006969392, 0.483391881, 0.2013999075, 0.3852226436, 0.2566985488, 0.2287191749, 0.3226880729, 0.0051960615, 0.0316116847, -0.1580836326, 0.1246570125, -0.1312188655, 0.1465569735, 0.0016204292, -0.14200297, -0.1955582201, 0.135531947, 0.0595098734, -0.1583063453, 0.0607260205, 0.0952027068, -0.1042194739, 0.1780011952, -0.0132490965, 0.3717622161, -0.023819143, -0.2368369102, 0.1435661763, -0.2938762903, 0.0356036201, 0.0739236772, -0.0384560227, 0.3780092895, 0.3359929621, 0.0807104707, 0.0478106849, -0.2073845714, -0.3678787053, 0.0716592371, 0.344057411, -0.5090510845, 0.2327921838, -0.2995886803, 0.3964603245, 0.1238908544, -0.1198131517, -0.2803930938, -0.596216917, -0.1310130656, 0.5344038606, -0.0878549218, 0.140951097, -0.1044900566, 0.1036586836, -0.2177423537, 0.4064001143, -0.1127119437, -0.2866862118, -0.2238866091, -0.143870905, 0.3367703259, -0.2551402152, 0.2371952683, 0.1972366422, -0.283210814, 0.1011272669, -0.3656711578, 0.1703360081, -0.0298880953, 0.0133360382, 0.1109324619, -0.0670834258, -0.0422331952, -0.2127744108, 0.1584322006, -0.1304795444, -0.2130653709, 0.3102200031, -0.1451125294, 0.0382952951, -0.1842953265, -0.218840614, -0.4120940268, -0.1025575399, -0.1735719889, -0.2267582417, 0.3224339783, 0.0706639737, -0.0400239639, -0.0154568898, -0.09489692, -0.0137676755, -0.1022758111, -0.0214021467, -0.1632137448, 0.0092589632, -0.144397825, -0.053385511, 0.0301888511, 0.1384503245, 0.4326982498, -0.3306241035, 0.0789940283, 0.1064506397, -0.1260216981, 0.1771830469, -0.1903128326, 0.3407358825, 0.3817727566, 0.0495489463, -0.0437266827, -0.1391006559, 0.1047363877, -0.0750268474, 0.050785847, 0.0907469094, 0.3363539279, 0.1733753085, 0.6802123785, 0.3181333542, 0.0758746639, 0.4411139786, -0.0873882994, 0.1266501993, -0.2016422004, -0.4437972009, -0.166888535, -0.3328515887, 0.0288298838, -0.1490572095, -0.1336887181, -0.4281875789, -0.2398666739, 0.5580089092, -0.3731171489, -0.2661547959, -0.0114973122, -0.4910700619, 0.2942596972, -0.0721301436, 0.0983667448, -0.0680479705, -0.0286517721, -0.1811808348, 0.2417276502, 0.1317720115, -0.2868563235, -0.31337291, -0.2984550297, -0.4311947227, 0.3018602729, 0.2005130202, 0.7738984823, 0.0186730698, -0.0527884774, 0.0111617446, -0.1868258119, 0.917319119, -0.5690351725, -0.3967111707, 0.3345103562, -0.4721474051, -0.2147319466, -0.2099571079, -0.2013518661, 0.5055502653, 0.3819591701, 0.5023781061, -0.1614257991, -0.3780627549, 0.1530837715, -0.2570293546, -0.1191148013, 0.0627679154, -0.3022753894, -0.0154425679, -0.2401997149, 0.0927343667, -0.2525689304, 0.111454159, -0.2179808319, -0.1276563853, -0.1641672701, -0.1095555723, 0.2863309979, 0.0590848289, -0.0361821204, -0.1694265455, 0.0408688635, -0.0105613396, 0.1652773768, 0.3650978506, 0.1900336146, -0.3747361898, -0.1727476567, 0.1968024671, 0.0158032011, 0.3392809629, 0.3174798787, 0.2047662735, 0.0000433788, -0.0467100218, 0.2545279562, -0.3137808442, 0.0875374973, 0.3993990123, -0.0182165708, -0.5664706826, -0.0736856535, -0.0969470739, 0.38612023, -0.1427973807, 0.5104858279, -0.3036782444, -0.2402491122, 0.4625007808, 0.0840422884, 0.840662539, -0.3637133241, 0.0132834641, 0.0892838389, -0.0050923191, 0.0694169551, -0.06289839, -0.0200169533, -0.2953957617, 0.0041266778, -0.0972204134, 0.0550888591, 0.3370893896, 0.2183582187, -0.1210360602, 0.4495355487, -0.0287260097, -0.009624958, -0.0391498059, 0.1835768074, 0.4047144353, -0.1066560447, 0.1088414416, -0.0186673142, -0.042348098, -0.1334840804, -0.0020872599, 0.0470463745, 0.2909998, -0.1496486068, -0.3882097006, -0.0935220048, -0.1085725427, 0.1244036853, 0.2220885605, 0.1331908405, 0.0084560374, -0.0236115381, -0.0216736123, 0.1052142829, -0.0715591908, -0.1477668285, 0.1101584733, 0.3326568305, 0.1448523849, 0.00326542, 0.3560245931, 0.1236724555, -0.2299613208, 0.065337874, -0.2153464407, -0.2262954563, 0.0706192926, 0.0178396441, 0.1855375022, 0.0778600723, 0.1521412134, -0.0188029669, -0.1115507483, -0.2047350705, 0.0256376434, -0.1125885919, -0.1400845796, 0.4181125164, -0.0282927826, -0.3238863647, -0.0096673919, 0.4117645323, 0.1827362478, -0.0839910805, 0.1819820553, 0.0767891109, -0.0807368159, -0.2318512201, -0.1778572798, 0.3159953356, -0.1251136065, 0.2839007378, 0.0257562734, -0.269692719, 0.1455885619, 0.0623941123, 0.0602630116, 0.280089587, -0.1935102791, -0.4024761617, -0.434191376, 0.3008683324, -0.0027208324, 0.0832221657, -0.0944674462, 0.2488301992, -0.172198087, 0.3336553872, -0.2000491023, 0.0919545293, -0.1073142812, 0.2210527062, -0.2320584357, 0.0096005881, -0.164463073, -0.0914379433, 0.0653491244, 0.0121604269, -0.2207486928, -0.0092054931, -0.0578293577, 0.1484887153, 0.1470879465, -0.1971918941, 0.0179157835, -0.0090581402, -0.1415071338, -0.2273655832, 0.1838723123, 0.3537552655, -0.223185271, 0.1348128766, 0.3172183335, 0.1472458541, 0.0894243866, 0.2858356833, -0.1238541678, 0.0725884736, 0.0483573489, 0.4121783078, 0.1053222641, -0.1657756716, 0.0245062262, 0.149843514, -0.0505776592, -0.0450952351, 0.3554061055, -0.2137867063, 0.0687397197, -0.0204052497, 0.3739393055, 0.3854631484, -0.1282382607, 0.01307783, 0.2367486358, 0.0610653162, 0.008467216, -0.1731078178, 0.4683956206, 0.0407815725, 0.0509881042, 0.3392883837, 0.3380614519, -0.1434526145, 0.1656932831, 0.1148949713, -0.0518442057, -0.0311295222, 0.1816535294, 0.1359548569, 0.0247088596, 0.3240539432, 0.1971984506, -0.2997606099, -0.1530557126, 0.2907688916, 0.0458551012, 0.5280522108, 0.0002220765, 0.1636799276, -0.1134030968, -0.6981275678, 0.0208139904, 0.1347818524, -0.4347141981, 0.2099061608, -0.0852789506, 0.222435087, -0.226705119, -0.4809595644, -0.1522949338, 0.479629904, -0.2569240034, -0.312117517, -0.2767158747, -0.1225166693, -0.1777711362, 0.0527486205, -0.0898243636, 0.1594697982, 0.7063726187, 0.0123733059, -0.0512498207, -0.2058639973, -0.2766356766, -0.042479977, 0.3352660537, -0.0077605899, 0.4334903061, -0.067799516, 0.1059243903, -0.02949192, 0.1589469463, 0.4662959874, 0.7281751633, -0.4269513488, -0.1200885773, 0.118756406, -0.0645891801, -0.0706499293, 0.3842760921, 0.0765928924, 0.2253124863, 0.3098934591, -0.0882094502, 0.0227854569, -0.2762962878, 0.3280371726, 0.3067685962, 0.0891913101, 0.4277428091, 0.0766936392, -0.054282967, 0.2583426833, 0.0579859689, -0.3257124722, -0.2193246335, 0.5333287716, -0.4387637973, 0.2860153019, 0.2186448425, 0.0412960686, 0.0746771246, 0.3803935945, 0.2904959917, 0.0493488945, -0.2989239097, -0.2100403756, -0.414665699, 0.0077226907, -0.2228162885, 0.2766835988, 0.0260397717, 0.0152188679, -0.0235643256, 0.0177251156, -0.0496936217, -0.2223455161, 0.3785586655, 0.3334755301, -0.5266215205, 0.1982721537, -0.0054433811, -0.0264129974, -0.023563724, -0.3387913406, 0.3580262661, 0.0833533332, -0.1214981675, 0.1432865262, 0.1241793483, 0.0873631388, 0.099992387, 0.0031536156, 0.2782768011, 0.5841791034, -0.0505015366, 0.0479513966, -0.2000543475, 0.0347694866, -0.1239150614, -0.0102263577, -0.0064630732, 0.3861202002, -0.154722631, -0.0461016446, 0.0063527776, 0.1711961329, 0.0356914736, 0.1453521103, -0.4596280456, 0.3033053875, 0.1619606316, 0.0160799529, -0.1337857395, 0.4253681302, 0.1762629598, 0.3895446062, -0.3170859814, -0.2272405475, 0.3292977214, -0.0643050894, -0.1734613478, -0.6152849197, 0.2426210344, -0.1712379605, 0.0917392224, -0.5049585104, -0.3762701452, 0.1952893287, -0.1857611686, -0.562841475, 0.2360657454, -0.0989015251, -0.1997236758, -0.0967540145, -0.1907406151, 0.0916336402, -0.1020651311, 0.2155119032, -0.0274184979 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
same problem. `encoded_dataset = core_data.map(lambda examples: tokenizer(examples["query"], examples["document"], padding=True, truncation='longest_first', return_tensors="pt", max_length=384), num_proc=16, keep_in_memory=True)` it outputs: ``` Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787499 indices in 25568385696 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Spawning 16 processes ```
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
301
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` same problem. `encoded_dataset = core_data.map(lambda examples: tokenizer(examples["query"], examples["document"], padding=True, truncation='longest_first', return_tensors="pt", max_length=384), num_proc=16, keep_in_memory=True)` it outputs: ``` Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787500 indices in 25568400000 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Done writing 1787499 indices in 25568385696 bytes . Set __getitem__(key) output type to python objects for ['document', 'is_random', 'query'] columns (when key is int or slice) and don't output other (un-formatted) columns. Spawning 16 processes ```
[ -0.3812628686, -0.1599826813, -0.0257185865, 0.2450917512, 0.1385163963, -0.1244134754, 0.2277839482, 0.3551834524, 0.0971073508, 0.1650543958, 0.0904947147, 0.4780939221, -0.4379875362, 0.3225880563, -0.3071639538, 0.074354358, 0.0885859057, -0.0340095311, -0.2489498705, 0.2080955654, -0.240830332, 0.2539783716, -0.3136199117, 0.132414639, -0.54488796, 0.0372944437, -0.0100324191, 0.2946362197, 0.0041619674, -0.560477376, 0.3350959122, 0.1862284243, 0.0239845533, 0.4058555961, -0.0001238069, 0.1744507104, 0.332208097, -0.1320036501, -0.0576935671, -0.3747684956, -0.1845240444, -0.177474916, 0.2513704002, 0.0584545396, 0.194839865, 0.084687598, -0.0990760997, -0.2675632536, 0.2351569235, 0.4671221375, 0.0967172831, 0.2684924304, 0.2412029803, 0.1626383066, -0.0700327829, 0.129364863, -0.05867007, -0.0073627345, 0.2534243464, -0.2842434645, -0.0843151957, 0.2644785941, -0.2236344814, -0.2193563879, -0.1762114465, -0.1897658706, 0.595693171, -0.640586257, 0.202837795, 0.0316085219, -0.2833523154, -0.06021256, -0.3970500231, -0.165837571, -0.281468451, -0.6259977221, 0.2206948847, 0.0547296591, -0.1740380675, 0.1226080433, -0.4526480436, -0.2315920591, -0.0487774685, -0.058144208, -0.1401832253, 0.5158825517, 0.2073031217, 0.307647258, 0.1674180329, 0.1691039503, 0.1405951977, -0.043947313, -0.063042216, 0.1547044665, -0.3959686756, 0.0444800034, 0.0572552271, -0.153799355, -0.2437873185, -0.0653124303, -0.0806688294, 0.100731656, -0.1338205338, 0.0974463224, 0.3817778528, -0.0635504723, 0.2099064589, 0.3211015761, 0.2443681508, -0.1982806921, -0.0408754498, 0.0844114646, 0.3090513051, -0.0766793638, -0.0829106569, 0.3224015832, 0.0780443549, -0.1507155597, -0.2008780241, 0.1684620976, -0.1229614168, -0.1415818334, 0.0955839008, 0.1618540734, 0.0173612665, 0.7640122771, 0.1510401666, 0.1550602615, -0.3262264431, -0.1650593877, -0.0813881159, -0.0162960757, -0.383908838, 0.1201189235, 0.2784775496, -0.0458315127, -0.0025161554, -0.0125777991, -0.3755192161, -0.2901799381, 0.1588218659, -0.269151926, 0.1290227026, 0.643438518, -0.084770672, 0.037868809, -0.0311034247, -0.2311685532, 0.0893549696, 0.2703111172, -0.545425117, -0.1998848468, -0.1913018823, 0.0830652788, -0.00902519, 0.2907005548, -0.1352845579, 0.2626662552, 0.4345032871, -0.3390247524, -0.3026489019, -0.3347219527, -0.4246219397, -0.302988708, -0.0268523898, 0.2384123057, -0.3886894286, -0.0208520032, 0.0716138333, -0.1603697538, 0.3210647106, 0.228707999, -0.0067514032, 0.0228168666, -0.1003551781, 0.177985236, 0.1289134622, -0.233431831, -0.1171934903, 0.2298338115, 0.0215959437, 0.3336879015, -0.0718950331, -0.2325263172, 0.34098351, -0.1377683878, 0.2706861794, -0.0474333204, -0.1684701443, 0.0419766754, -0.4458484054, -0.0475395136, -0.0104413806, -0.0907256007, 0.3886666894, 0.1698444784, -0.1258535981, -0.4694311917, 0.3113692105, -0.1126033217, 0.2983155549, 0.1176050007, 0.0700893477, -0.0038853306, 0.1334569752, -0.2639539242, -0.4916708767, 0.1975853443, -0.2110625505, 0.0598971434, -0.0548027791, 0.0016008319, 0.1356360912, 0.170398131, -0.208983168, -0.2314665467, 0.0527524799, -0.0362775773, -0.2970741093, -0.0225935075, -0.1978594661, 0.6065133214, 0.0651134998, 0.1337964088, -0.1734607369, 0.2274012417, -0.1264916062, -0.432724148, -0.3220409453, 0.2733949125, -0.014586933, -0.0576649532, -0.2054569274, 0.412060976, 0.4922932684, -0.0928070918, -0.1072131619, 0.2081220448, 0.2767288387, -0.2052214891, -0.1986121386, 0.089764528, 0.0358789153, -0.1755610704, 0.2432492673, 0.4486859143, 0.2031268626, 0.3599851429, 0.2320651859, 0.2206025571, 0.2997631729, 0.0055636717, -0.0274564568, -0.1561451852, 0.1594949365, -0.1439871341, 0.1384496093, 0.0725638717, -0.1243335009, -0.2617253959, 0.1637733579, 0.0659066588, -0.1640599221, 0.0554419421, 0.0439117402, -0.1209326982, 0.1442405581, 0.0353029668, 0.3846463561, -0.0169441029, -0.1841904074, 0.1875166595, -0.2923647165, -0.0041845432, 0.1214144379, -0.0603462607, 0.4126352966, 0.3325662017, 0.0933478698, 0.012138349, -0.2061802596, -0.3470262885, 0.126233831, 0.3581796288, -0.4770469368, 0.2011184245, -0.2688546181, 0.3921819627, 0.1077220067, -0.0824890807, -0.2518575788, -0.5163873434, -0.1252588779, 0.5447286367, -0.0894417539, 0.1139657721, -0.0750086382, 0.0922438875, -0.1993823349, 0.3349093199, -0.1236952245, -0.3494333029, -0.1855384558, -0.1118902341, 0.3578801453, -0.3373329043, 0.2036118805, 0.1893173307, -0.2535941303, 0.1800453961, -0.3561490178, 0.0978304595, 0.0027095405, 0.0007186446, 0.0373479389, -0.0380868465, 0.0021099094, -0.2566198707, 0.1516732424, -0.0926753208, -0.2342156619, 0.3143595755, -0.1155803427, 0.0484066457, -0.2818495035, -0.3552567959, -0.4357713461, -0.1446246803, -0.1148802638, -0.2469651848, 0.3538690805, 0.2138125896, 0.0279248729, 0.0080097625, -0.0402046889, 0.0558432899, -0.0504350848, -0.0469998159, -0.1569674164, 0.0019500413, -0.1449821442, -0.0489737354, 0.0109180566, 0.2259829491, 0.4416412413, -0.3533617556, 0.1268651038, 0.0998176858, -0.1105589569, 0.2188430279, -0.2389683425, 0.3640261889, 0.3983311653, 0.0564017557, -0.0557651222, -0.1833667159, 0.1532929689, 0.0631322637, 0.0367056094, 0.1003944501, 0.3216459453, 0.1986770034, 0.6136782169, 0.4047027826, -0.0415370874, 0.4049913585, -0.0742643625, 0.0647049844, -0.1796073616, -0.3545345962, -0.1869885027, -0.3202338815, -0.0462962426, -0.15212062, -0.1201907024, -0.4881995916, -0.287545234, 0.5973170996, -0.3989579678, -0.2220169008, -0.0257759281, -0.4343623519, 0.2957082391, -0.0880859345, 0.0619179308, -0.0284437742, -0.0533098951, -0.2206206322, 0.1752649099, 0.1265858412, -0.3411031961, -0.2711301446, -0.3298739791, -0.4660464823, 0.2708950341, 0.2392299473, 0.6756353974, -0.0031586811, -0.0472993106, 0.0279798396, -0.1610236168, 0.9008375406, -0.5975760221, -0.3845264614, 0.2998616099, -0.441637069, -0.2805395722, -0.1464085877, -0.1916858405, 0.5185413957, 0.4178611934, 0.4736287296, -0.1258114427, -0.2736024857, 0.0931891352, -0.1973988563, -0.1291915327, 0.0807632059, -0.2861380279, -0.0162171796, -0.182430476, 0.0195707977, -0.2209486365, 0.1472902, -0.196748063, -0.1496359855, -0.1174030975, -0.0945642367, 0.2924085259, 0.0564405136, 0.0141238756, -0.1687941849, 0.0732962415, 0.0023318278, 0.1798490137, 0.2803764641, 0.2534048855, -0.4210767746, -0.1872626096, 0.1640624553, 0.0486609824, 0.2841587663, 0.2582038939, 0.2260947824, -0.0701887533, 0.051992394, 0.1801950932, -0.3139068484, 0.0786771774, 0.3798126876, 0.0034893737, -0.5512812138, -0.1097422242, -0.0697430745, 0.4393828511, -0.1443437636, 0.5627087355, -0.4565916359, -0.275508374, 0.3744552433, 0.1028130203, 0.7571622729, -0.3558428288, -0.0179324392, 0.1034673676, 0.0332224034, 0.1023249775, -0.0298273768, 0.0912708044, -0.2797411084, -0.0282341465, -0.0703880861, 0.0556830131, 0.2865792513, 0.1877315044, -0.145940274, 0.3820242286, 0.0152318934, -0.089609392, -0.0244374573, 0.2167615145, 0.4826404154, -0.0553406402, 0.1282263845, -0.0104419561, -0.0659206286, -0.1713444442, 0.0468596704, 0.0239158813, 0.2783243656, -0.1352671981, -0.3766933978, -0.0313110985, -0.1759741455, 0.1755465716, 0.1576111317, 0.1429029107, 0.0067417319, 0.2085308433, -0.0955408439, 0.0447448269, -0.1262191236, -0.1333510727, 0.0964357853, 0.3388731182, 0.2169423401, 0.0244922359, 0.3706183136, 0.0890446007, -0.2019162923, 0.0859586746, -0.2295128256, -0.225186184, 0.1175146028, 0.0538832173, 0.0550668389, 0.1243347377, 0.1317674518, -0.0027598303, -0.1668454409, -0.1685528457, 0.0406235382, -0.0621810369, -0.1579101533, 0.4621097147, -0.0469863266, -0.3780897856, 0.0285822637, 0.4684546888, 0.237608403, -0.066578798, 0.1323940158, 0.0757082999, -0.0553673618, -0.2345048934, -0.1947104186, 0.2041232735, -0.1385969967, 0.318777591, 0.061827939, -0.2533580661, 0.1607475877, 0.1019406915, 0.0467938595, 0.3771518171, -0.2085136473, -0.3417023122, -0.4462181926, 0.2933818102, 0.0455733463, 0.101322867, -0.1182619631, 0.1660130769, -0.1374005973, 0.3116115928, -0.2197199315, 0.1450558454, -0.0788094252, 0.2332204878, -0.1382718533, 0.0145996399, -0.0921099782, -0.1046823189, 0.0761474147, 0.0331909508, -0.2527059317, -0.0344753191, 0.0060306089, 0.1244490221, 0.1173034683, -0.2294045836, -0.0421267711, -0.0710528865, -0.1012942195, -0.2299920768, 0.1830629706, 0.3245703876, -0.2118427902, 0.1726922989, 0.2158286721, 0.223104015, 0.0967912599, 0.3091025651, -0.2309209257, 0.0686678886, 0.0627952889, 0.4110857546, 0.1045887843, -0.1674642116, -0.0104248133, 0.0753286406, -0.0851459727, -0.0226068571, 0.3046312928, -0.2346468866, 0.011380027, 0.0177814141, 0.363614738, 0.3809761107, -0.1609292328, 0.0975752175, 0.128952682, 0.0942887142, 0.0734336674, -0.1789150536, 0.5030882955, 0.0711810142, 0.078821376, 0.2968463004, 0.2957262695, -0.1840435565, 0.1694108248, 0.0986318663, -0.0717844218, -0.047362607, 0.2588550746, 0.1763657779, 0.0519250594, 0.2686648965, 0.1383131742, -0.3351880014, -0.1445140094, 0.2858962715, 0.0185993481, 0.5381386876, 0.026138179, 0.1412216872, -0.0872338414, -0.5816611052, 0.0283282194, 0.0647230968, -0.4965639412, 0.2716894448, -0.01335961, 0.216737777, -0.2738091946, -0.4163637161, -0.1943266243, 0.4032901227, -0.2760808766, -0.28719908, -0.2953161299, -0.1381359696, -0.0973222181, 0.0780923441, -0.0919772014, 0.1750065535, 0.7415691018, 0.0666245669, -0.1233503595, -0.0933172479, -0.3392296433, 0.010192615, 0.3148337305, -0.0212051757, 0.4458220899, 0.0185705051, 0.0203919373, -0.060614761, 0.0977775529, 0.4438872039, 0.6963077784, -0.4553193152, -0.0343555659, 0.1794538945, -0.0795085281, -0.091158174, 0.4181699753, 0.1046569869, 0.3097866774, 0.2685209811, -0.06138134, 0.0192767307, -0.2396437824, 0.3282628655, 0.3821767867, 0.0546371043, 0.3476727605, 0.1113525182, -0.08316084, 0.2299304307, 0.0156460516, -0.326849103, -0.2684851885, 0.5566340685, -0.4823423326, 0.2635052204, 0.2357003838, 0.0446099043, 0.0398490503, 0.4240777194, 0.2635847032, 0.0626650825, -0.30931288, -0.1838687062, -0.3888841271, 0.0516257659, -0.1601486802, 0.223379761, -0.0051428531, 0.0271895379, -0.0624477454, 0.0350040346, -0.1013171747, -0.2399442047, 0.399810046, 0.3118212819, -0.5812188983, 0.1934359223, 0.0182104874, -0.0433616117, 0.0252559856, -0.3324998021, 0.334138304, 0.0686643273, -0.1056521535, 0.0980460495, 0.1510054618, 0.0682479516, 0.1717231721, 0.0574420244, 0.2719837129, 0.6113706231, -0.0759608895, -0.0164806526, -0.228666544, 0.1080481485, -0.1091564149, -0.0437675305, 0.05938337, 0.4581900537, -0.1972040683, -0.0211738683, -0.0006724909, 0.1767241806, 0.0470646471, 0.1126625016, -0.4025766253, 0.2158270478, 0.191621393, 0.064923577, -0.1029514372, 0.4361128509, 0.1671411395, 0.3154138029, -0.2531250417, -0.2148841023, 0.32750085, -0.0833030865, -0.0832166374, -0.5843409896, 0.2102662921, -0.162689507, 0.1443042755, -0.4967544079, -0.3728491664, 0.1991521865, -0.2268795222, -0.6331868172, 0.2344036251, -0.0566811748, -0.154506579, -0.0621901937, -0.2077104151, 0.1369818449, -0.1371985227, 0.1999458671, -0.1195717081 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Thanks for reporting. Which tokenizers are you using ? What platform are you on ? Can you tell me which version of datasets and pyarrow you're using ? @timothyjlaurent @richarddwang @HuangLianzhe Also if you're able to reproduce the issue on google colab that would be very helpful. I tried to run your code @richarddwang with the bert tokenizer and I wasn't able to reproduce
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
64
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Thanks for reporting. Which tokenizers are you using ? What platform are you on ? Can you tell me which version of datasets and pyarrow you're using ? @timothyjlaurent @richarddwang @HuangLianzhe Also if you're able to reproduce the issue on google colab that would be very helpful. I tried to run your code @richarddwang with the bert tokenizer and I wasn't able to reproduce
[ -0.4514067769, -0.0183557644, -0.0187174641, 0.2539694309, 0.1591782868, -0.1641506404, 0.2910156548, 0.3014788628, -0.0354783833, 0.1461099088, 0.0482644364, 0.4889172614, -0.4316675663, 0.3358332217, -0.3009808362, 0.0277108401, 0.1179320291, -0.0190120395, -0.2634868026, 0.2409517169, -0.2404620796, 0.2257552743, -0.4016409814, 0.1766659468, -0.6489457488, 0.0602546185, -0.0938617513, 0.2311897725, -0.0793513581, -0.5861321092, 0.3002743125, 0.2776138186, 0.0705377683, 0.4927060306, -0.0001242773, 0.0863857046, 0.3700331748, -0.0688939691, -0.0755965039, -0.4253844917, -0.1398860663, -0.1962036192, 0.3268499672, 0.1186024994, 0.2297608107, -0.0144223021, -0.1105303392, -0.1358256191, 0.2951321304, 0.4044715464, 0.0998645201, 0.210828498, 0.2679287195, 0.1761288047, 0.026666401, 0.1134239361, -0.0295608919, 0.0634086356, 0.3047253191, -0.3775466383, -0.0981571898, 0.1819475591, -0.2512393892, -0.2436912656, -0.1529685706, -0.1884294599, 0.5462464094, -0.6417781115, 0.198192507, 0.050744649, -0.1269940883, -0.0952431932, -0.4095525444, -0.1634819657, -0.2056478858, -0.5241120458, 0.2612171471, 0.088713713, -0.1917434037, 0.1744313687, -0.5121268034, -0.1702477038, -0.0599608831, -0.0430707447, -0.1608612537, 0.6147719622, 0.1970791519, 0.2824650109, 0.1318353713, 0.1094723269, 0.3357940912, -0.081371069, -0.1276593804, 0.1960500628, -0.4639243484, 0.0747697428, 0.0073756361, -0.0823292211, -0.2194858789, 0.0200009476, -0.2418674976, 0.1100882068, -0.0998961553, 0.07879778, 0.3843362927, -0.0076071345, 0.2199825943, 0.3408828974, 0.2288217694, -0.2596556544, 0.0027704716, 0.0371753089, 0.2253895849, -0.1269138008, -0.0501923524, 0.3050421178, 0.119452782, -0.2124559134, -0.237273857, 0.1194868386, -0.2387346625, -0.1723512411, 0.0948837772, 0.1854166538, 0.0307486542, 0.705421865, 0.08332818, 0.1961913407, -0.2631705105, -0.1573430151, -0.0654680058, -0.0452280007, -0.4083969891, 0.15986678, 0.245235011, 0.0504904203, -0.0003737921, 0.0509882756, -0.3588192761, -0.2416550666, 0.1078228801, -0.2778947353, 0.0396643765, 0.653049171, -0.0253035165, 0.0413961299, -0.0589493401, -0.2250757664, 0.0949929729, 0.2815294266, -0.5119838715, -0.1841508001, -0.2612279654, 0.0831528232, -0.0231677666, 0.2442414612, -0.2944863439, 0.2875612378, 0.3829673827, -0.2585480809, -0.2988174558, -0.3133197129, -0.3318472505, -0.3129889071, -0.0024774775, 0.3077675402, -0.4657447934, -0.0098970728, 0.0874544233, -0.1941268742, 0.377068758, 0.1856148392, -0.0613607392, 0.0669880435, -0.1267244369, 0.2158233672, 0.1401773691, -0.1279755384, -0.112433441, 0.221722573, 0.0198817812, 0.2737294436, -0.0765964612, -0.2837847471, 0.3305279016, -0.1273435652, 0.2405417562, -0.0251977388, -0.1801248789, 0.0559503846, -0.4307543933, -0.0424649678, -0.0346669666, -0.0584330857, 0.3701486886, 0.1658087075, -0.1280090511, -0.5494301319, 0.3390698135, -0.0956564397, 0.3101181984, 0.046828907, 0.2010081708, 0.0631357208, 0.1250198334, -0.3416932821, -0.4653608799, 0.2084012777, -0.225908801, 0.0564941652, -0.1141112596, -0.0186335891, 0.0731930733, 0.2188660353, -0.2546341717, -0.1963988841, 0.054820288, -0.0569622815, -0.2888917327, -0.0090969345, -0.1978033632, 0.6334376931, 0.1330012828, 0.1863331348, 0.0088009918, 0.3338907659, -0.1678681672, -0.4845398068, -0.2472649813, 0.1851916164, 0.0388390422, -0.0657137185, -0.2361523956, 0.4898023009, 0.4748798311, -0.118436344, -0.0471903458, 0.1707309335, 0.2384604961, -0.2020015419, -0.1777735949, 0.017707767, 0.0314921513, -0.1478210241, 0.3008820117, 0.4878905416, 0.136950925, 0.3793054223, 0.160511747, 0.2333789915, 0.2646211386, -0.0008948265, 0.0150105776, -0.1043363959, 0.1605807245, -0.1033005789, 0.1602765918, 0.0734187216, -0.0789120123, -0.2140071541, 0.1174609587, -0.0077375718, -0.2083767951, 0.0450219475, -0.0087572085, -0.116595082, 0.1818485409, 0.0216805059, 0.4007754326, 0.0097521432, -0.2446663827, 0.1888061613, -0.2269084305, -0.0186136216, 0.1428356767, -0.0703979358, 0.4502501488, 0.2981048524, 0.1378421634, 0.0256139189, -0.2035499364, -0.3304828703, 0.1311552972, 0.4114910066, -0.5120652318, 0.2068119347, -0.3035527766, 0.2663401365, 0.0753611103, -0.174827382, -0.3257459402, -0.5263912678, -0.1301474273, 0.5010660887, -0.0153541863, 0.1526306421, -0.0430885404, 0.0754177496, -0.1909262389, 0.3626383543, -0.172919333, -0.3490325809, -0.256805867, -0.0965511501, 0.4135926366, -0.2263157219, 0.2242783159, 0.1385641098, -0.2426474839, 0.1376254261, -0.3264597356, 0.1218764558, -0.0456870236, 0.0993345454, 0.0476024896, -0.0871099755, -0.0611735694, -0.219895795, 0.1496850848, -0.13085033, -0.2919814289, 0.2978999317, -0.159238413, 0.0333514772, -0.2079055458, -0.292170614, -0.447247833, -0.0652052462, -0.1241436303, -0.2491880208, 0.3339014649, 0.1426371485, 0.0502238572, -0.0268354286, -0.1156215966, -0.0214424729, -0.0339341499, -0.0353108682, -0.1688207984, 0.0389614441, -0.1542485952, -0.0213814676, 0.0638004839, 0.1187987849, 0.4105750322, -0.3101977408, 0.0174234714, 0.0785767883, -0.021666551, 0.2032387555, -0.2102434635, 0.3423298299, 0.4269158542, 0.065337114, -0.0130830668, -0.1810951978, 0.044557184, -0.0369704366, 0.0857581645, 0.0567322895, 0.317771703, 0.1290831417, 0.6365388036, 0.3438289165, 0.0245845281, 0.39883551, -0.1147426441, 0.0726943985, -0.1767135113, -0.4179880321, -0.1399570554, -0.3385906518, -0.0034157266, -0.1102152392, -0.124660179, -0.4634777904, -0.2985058725, 0.5199303627, -0.4142764807, -0.2368217707, -0.0435290188, -0.4586129785, 0.2934300005, -0.0736257359, 0.0203418918, -0.0263482928, -0.0830059499, -0.2813159227, 0.2080482692, 0.0749505684, -0.3284226954, -0.2657975256, -0.2576185465, -0.4092135727, 0.3226162195, 0.2142199129, 0.646294117, 0.0636078864, 0.0171450004, 0.0897398964, -0.1505378187, 0.9170180559, -0.5295392275, -0.4050596952, 0.2950896025, -0.3897667229, -0.2402524054, -0.2102428526, -0.2094304413, 0.5488242507, 0.4073244631, 0.4270007014, -0.1365407705, -0.2981923223, 0.1650775224, -0.1730673611, -0.0973169804, -0.0574684441, -0.3223574162, -0.0002323151, -0.1945851594, 0.1016059592, -0.2478358895, 0.1796013564, -0.2818058431, -0.1345823109, -0.0977981389, -0.1065053865, 0.2231222391, 0.1205077991, -0.0291969404, -0.2103306353, 0.0621237308, 0.0158561319, 0.1463370174, 0.4021161199, 0.2343922108, -0.3336499333, -0.2025297135, 0.1285563409, 0.0272814855, 0.3452242315, 0.2670356035, 0.1780944467, -0.0470146872, -0.02553959, 0.162268132, -0.1858316958, 0.0603774562, 0.3804245591, -0.0274199974, -0.5772966146, -0.067548722, -0.0502462611, 0.4389662743, -0.1459269524, 0.4760756791, -0.3540569842, -0.2528218329, 0.388663739, 0.0871432647, 0.8736890554, -0.3867264688, -0.051238291, 0.1110442728, 0.0254610851, 0.1342846304, 0.0106234187, 0.0341233313, -0.3378764689, -0.0024988223, -0.0574131794, 0.0252357498, 0.2827627659, 0.2086387873, -0.1994738877, 0.3970703781, -0.0344186164, -0.0258600861, 0.0347807072, 0.1602526158, 0.4071725607, -0.0319600739, 0.1021644846, -0.0038298275, -0.0508485362, -0.1375650465, -0.0000857007, 0.0362851135, 0.233169198, -0.1255357265, -0.4613440335, -0.0750194862, -0.2013406903, 0.1040432751, 0.2047283947, 0.0609577, 0.0292198174, 0.0799923241, -0.0750481114, 0.0657525808, -0.1150755286, -0.1086520031, 0.1019140109, 0.299626112, 0.1565519571, -0.0162426271, 0.3197108209, 0.0899088234, -0.2710873783, 0.0669752136, -0.193017602, -0.1884998977, 0.0744527802, 0.0479699858, 0.0993243307, 0.0851055533, 0.1921525896, -0.0828154907, -0.0831781775, -0.2331726551, 0.0493477508, -0.048852969, -0.1012545675, 0.4635454118, -0.0041763559, -0.323970288, 0.0002365721, 0.4024420083, 0.2230579406, -0.0775500685, 0.1868162155, 0.1216438934, -0.0351369642, -0.2248840183, -0.1783465743, 0.238791272, -0.1943719983, 0.2779050767, 0.0762500986, -0.1605109572, 0.2321418524, 0.1646019816, 0.0615418367, 0.3667697608, -0.1725338995, -0.3573763669, -0.4265031219, 0.2562675178, 0.0572030544, 0.1014108583, -0.1279229522, 0.2864012122, -0.0851160437, 0.309871912, -0.208217904, 0.1187696308, -0.1360606104, 0.2225154489, -0.1965075582, -0.0179603957, -0.1610795856, -0.1194786429, 0.0611643456, -0.0054542953, -0.1573921591, -0.03201399, 0.0094412016, 0.1344663501, 0.1584110707, -0.2003344297, -0.0502525121, -0.036794316, -0.1069704667, -0.2200433016, 0.1807990968, 0.3339799941, -0.2093781829, 0.1154191047, 0.3636812866, 0.1378779262, 0.0411137342, 0.3112681508, -0.2223467976, 0.0580954477, 0.079749085, 0.4565373659, 0.1410526633, -0.1531625986, 0.0351947285, 0.0697182268, -0.0300757065, -0.0467677228, 0.275461942, -0.2803599536, 0.0170983262, -0.080173701, 0.3852858543, 0.4729863703, -0.1101136431, 0.0536670126, 0.2419432998, 0.1005078033, 0.0127544599, -0.1003078222, 0.5062841177, 0.0754643381, 0.0284593478, 0.3011085987, 0.2736850679, -0.1319654286, 0.1596789062, 0.1436668187, -0.0089022657, 0.0741019994, 0.2282643467, 0.1235294044, 0.0906233937, 0.283611834, 0.256000191, -0.3117287755, -0.1668029279, 0.2614682317, -0.069993183, 0.4988984466, -0.0726135895, 0.1265600324, -0.0666487664, -0.6106050014, 0.0236302838, 0.1232683286, -0.4722032547, 0.1165862381, -0.0490893498, 0.2964206934, -0.2452358305, -0.4382404089, -0.1968894005, 0.4906772077, -0.2664855421, -0.2746956646, -0.2911095917, -0.155542329, -0.1222532988, 0.0831956193, -0.1335172206, 0.1632053405, 0.7009337544, 0.0375612155, -0.1453173012, -0.2588686943, -0.3074167371, 0.0625747889, 0.2946560383, -0.0219733436, 0.4159756005, -0.0591314025, 0.0211353656, -0.0826200098, 0.1767220497, 0.5027845502, 0.7412923574, -0.4434116483, -0.0956697538, 0.1072113961, -0.0295980591, -0.0504566729, 0.3902240992, 0.1533709168, 0.2753219306, 0.2701472938, -0.0577950776, 0.023225693, -0.2116097212, 0.3104965091, 0.3349042237, 0.0382672809, 0.2798104584, 0.0830270797, -0.0984346867, 0.1646278948, 0.070489645, -0.3213471472, -0.1564125419, 0.504812777, -0.4208497405, 0.2050680667, 0.1837756187, 0.0468103737, 0.0648640916, 0.4589599073, 0.3885913193, 0.209923178, -0.3096044362, -0.270778805, -0.4379994571, 0.0589852706, -0.2144682258, 0.2642845511, -0.0245212279, -0.0231491942, -0.0907872021, 0.1096474901, -0.1216091663, -0.0915400907, 0.3047740757, 0.385222137, -0.6141396165, 0.2424552441, 0.0491851717, -0.0252739098, -0.0407548957, -0.3058137894, 0.3760472238, -0.0075482503, -0.1159946322, 0.0928703621, 0.1337735504, 0.1216402799, 0.1457856148, 0.0757276341, 0.2860178351, 0.6471264958, 0.0260008555, 0.1075968593, -0.2877635658, 0.0207423382, -0.1586352885, -0.0268221628, 0.0917569101, 0.3597250879, -0.1527473778, -0.007494593, 0.0157907028, 0.2090009451, 0.0230568014, 0.1894233972, -0.4248898327, 0.1550399363, 0.2044281214, 0.0485261008, -0.1781721413, 0.3578694761, 0.1304602027, 0.3544121683, -0.3445576131, -0.2215114832, 0.3429217339, -0.1219322234, -0.1181420237, -0.6038336754, 0.1825371832, -0.1230143085, 0.0716555268, -0.4986051917, -0.3239957094, 0.2401541919, -0.2024823129, -0.559458971, 0.2498542517, -0.0530508831, -0.1302674264, -0.102243565, -0.201597482, 0.1135979593, -0.1165664867, 0.1701203883, -0.0705464333 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Hi, Sorry that I forgot to see what my version was. But after updating datasets to master (editable install), and latest pyarrow. It works now ~
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
26
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Hi, Sorry that I forgot to see what my version was. But after updating datasets to master (editable install), and latest pyarrow. It works now ~
[ -0.4262240529, -0.0280846283, -0.0307076462, 0.1988402158, 0.1331439465, -0.137535125, 0.3073056936, 0.333330512, -0.0064562075, 0.1290374249, 0.0286433566, 0.4368829727, -0.4107377827, 0.296774298, -0.2640087903, 0.028000826, 0.1197287589, -0.0393837616, -0.3695648015, 0.2227407396, -0.2434660196, 0.2219716311, -0.3648297489, 0.1880378127, -0.5168522596, 0.0857323408, -0.0786066428, 0.2741608322, -0.0307961479, -0.6130791306, 0.3389734626, 0.2480799854, 0.0579000339, 0.4376123548, -0.0001256642, 0.1473097801, 0.3911255598, -0.0815784261, -0.0722283944, -0.3685736656, -0.1584385335, -0.1926397085, 0.3192968071, 0.0929172337, 0.2308606952, -0.0479287133, -0.0620316304, -0.1443230361, 0.217092678, 0.4277085364, 0.091703929, 0.2471804023, 0.3233216405, 0.1382608116, 0.1143365055, 0.1332389712, -0.0305652153, 0.0948626474, 0.3123919368, -0.3872240186, -0.1458236128, 0.209410727, -0.2584961355, -0.2159695327, -0.140100196, -0.1977105141, 0.7033733726, -0.6043231487, 0.1513262242, 0.0687063262, -0.1421924233, -0.1105683669, -0.4584231377, -0.1897013038, -0.2329024673, -0.467260927, 0.2183404416, 0.0801673457, -0.1841589659, 0.1617286056, -0.4882293344, -0.1844173521, -0.0824082568, -0.0564407073, -0.1429247111, 0.5605848432, 0.2558193505, 0.3145768344, 0.1811259985, 0.13589333, 0.271571219, -0.0153849898, -0.1004991606, 0.1912439317, -0.4333983362, 0.0872445852, 0.0809168145, -0.0300571956, -0.2048358172, -0.0127455285, -0.1876097769, 0.065165706, -0.051101625, 0.0766424909, 0.4456848502, -0.0959976763, 0.1797674, 0.2698795795, 0.2719273269, -0.2075209171, 0.0286726616, 0.0807526037, 0.3131717443, -0.1496838182, -0.008141621, 0.3094294071, 0.1514960676, -0.1890537292, -0.1789468229, 0.1035739928, -0.1564283967, -0.2262354791, 0.0571263209, 0.2013354748, -0.0015099749, 0.7359147668, 0.0622510426, 0.1686506569, -0.295673579, -0.0981433615, -0.0687070936, -0.0478757955, -0.4130520523, 0.0763136744, 0.2600795627, -0.0466353819, -0.0120454654, 0.0436597615, -0.3395041227, -0.2060765773, 0.0464951918, -0.2673592269, 0.0518142395, 0.6857973933, -0.0926614553, 0.0158422161, -0.1071030572, -0.1668680459, 0.0837772191, 0.318040669, -0.4997597635, -0.2156492323, -0.2343016267, 0.0743628368, -0.0113549978, 0.2890095115, -0.1569270641, 0.2223335207, 0.424398452, -0.3984226584, -0.2808879018, -0.352804184, -0.2661391497, -0.3301195204, -0.0200218074, 0.2311419845, -0.4519298971, -0.0070784353, 0.0694645792, -0.2467418164, 0.3404714465, 0.2008074969, -0.0547830723, 0.0209851339, -0.1204583719, 0.1243192405, 0.1210083961, -0.1624822468, -0.1700261533, 0.2329111248, 0.0909358263, 0.3055429757, -0.0249605291, -0.2829438448, 0.2935252786, -0.1453175992, 0.1870566905, -0.047050029, -0.1874557287, 0.0637619644, -0.414737016, -0.0254794899, -0.0138668464, -0.0490528643, 0.3853580952, 0.1553207487, -0.0500654243, -0.5330549479, 0.3955677152, -0.1283028126, 0.2941477597, 0.0562964156, 0.1294926107, 0.0282951258, 0.1651161015, -0.335367471, -0.5447023511, 0.2167761922, -0.3194432557, 0.0381355211, -0.1189156845, -0.0113429315, 0.1209755689, 0.2229208201, -0.2015698254, -0.1836010665, 0.0278964527, -0.0479688682, -0.2874888182, -0.0581978224, -0.2361511588, 0.6122265458, 0.1214622259, 0.1500260383, -0.0901403204, 0.2515522242, -0.1920496225, -0.4561063349, -0.2289398611, 0.2139546871, -0.0094457213, -0.0951694921, -0.1919602454, 0.4771195352, 0.4192665815, -0.0924055576, -0.1254464835, 0.0974675715, 0.2632504404, -0.2146301419, -0.1903714687, 0.0501565933, 0.039438922, -0.1361795813, 0.2064524889, 0.4271459281, 0.1136482134, 0.3887142241, 0.2086600959, 0.1980688125, 0.2781989574, 0.0070675979, -0.0115257045, -0.1324374676, 0.1837472022, -0.1079408452, 0.2337141931, 0.0872980431, -0.1605638415, -0.2234203368, 0.1846192628, -0.0384718366, -0.1715285033, 0.0879376233, 0.0761115104, -0.1311679035, 0.1681316942, 0.0018957563, 0.3951358795, 0.0263032075, -0.1902967691, 0.1835369319, -0.3049235344, -0.0213663038, 0.156835705, -0.0825074017, 0.4652839303, 0.3312570751, 0.1206731126, -0.0191457253, -0.2211037725, -0.2978809476, 0.1129522845, 0.386634171, -0.5138962269, 0.183179006, -0.2872391939, 0.3498781919, 0.092032671, -0.194966808, -0.3359867036, -0.5282183886, -0.1070325971, 0.5051029921, -0.0670928881, 0.1802399755, -0.0582268871, 0.0198351499, -0.1841713637, 0.3257267475, -0.1978469491, -0.3439945281, -0.2296530902, -0.1021255106, 0.3826709092, -0.305290401, 0.1771933436, 0.1326708049, -0.2272643298, 0.1391628236, -0.3415319324, 0.0712249205, -0.0616247132, 0.1284908801, 0.1239012778, -0.0415204577, 0.0358643644, -0.1854022443, 0.1367172152, -0.172531873, -0.2678058147, 0.3011960983, -0.162424773, 0.0868370831, -0.2424320132, -0.3241862655, -0.4599990249, -0.0813026503, -0.0785731971, -0.2051278055, 0.3805842102, 0.1081928462, 0.0498001948, -0.0413516797, -0.0785895213, 0.0359866023, 0.0005277675, -0.0447288118, -0.160464555, 0.0560940914, -0.144596532, -0.1038991883, 0.0696532801, 0.0801027939, 0.4333178997, -0.3374862671, 0.0384628661, 0.0815890655, -0.0312827937, 0.2492196709, -0.1725511104, 0.3564419448, 0.4469679296, 0.0673354268, -0.0272414014, -0.1913273335, 0.0769575164, 0.0046291496, 0.0519375838, 0.1071613654, 0.3089770675, 0.1419170052, 0.6148816347, 0.3018053472, 0.0772748664, 0.4116164744, -0.1048772782, 0.1169989556, -0.1796386987, -0.3834994733, -0.181512475, -0.3323108852, 0.0179434195, -0.1800165325, -0.1385158002, -0.5107501745, -0.2946906388, 0.508361876, -0.3593625128, -0.2251890451, -0.0294327401, -0.4158388078, 0.2737885416, -0.0482283682, 0.0361039639, -0.0130671654, -0.0562715754, -0.2096554935, 0.1837165505, 0.1155627817, -0.2950018644, -0.2535850406, -0.3127789497, -0.4444828928, 0.2949640453, 0.2194478065, 0.6344884634, 0.0734115392, -0.0596751943, 0.0646127984, -0.2058964819, 0.9419646263, -0.5384351015, -0.3539145291, 0.2767041028, -0.3353816569, -0.296050638, -0.2124643028, -0.1766385138, 0.5135709047, 0.3529113829, 0.3994942307, -0.1902299225, -0.3092124164, 0.2457105517, -0.194254905, -0.1138671041, -0.0568231307, -0.3268679082, -0.0149415713, -0.185835138, 0.0560889877, -0.3065467179, 0.1166411415, -0.2546602786, -0.0739465058, -0.1020662934, -0.0674837083, 0.2043440193, 0.0934563652, -0.0091582267, -0.2332933098, 0.0409649685, 0.0166018661, 0.1896850169, 0.3295454383, 0.2695168555, -0.3906280696, -0.1522638798, 0.1227660626, 0.0285160318, 0.3404768705, 0.2600503266, 0.185744822, -0.0897351727, 0.0456200317, 0.1567803472, -0.2219396681, -0.0335158966, 0.3762091994, -0.0683571175, -0.570235014, -0.121167928, -0.0074183531, 0.4382997453, -0.186873734, 0.4402970374, -0.3790723085, -0.2562081516, 0.3504360914, 0.0944137871, 0.829461813, -0.3685491979, 0.007513348, 0.1412821263, -0.0291990452, 0.0943378136, 0.0638991818, 0.0500574149, -0.3382292688, 0.0104199219, -0.0711940229, 0.0385399312, 0.2984249592, 0.1840957105, -0.1552240402, 0.4556516707, 0.0017165204, -0.0308161862, 0.0527690649, 0.1311539263, 0.4662724435, -0.0224105306, 0.0719885901, -0.0450139083, -0.0487075523, -0.2092825919, 0.0159177911, -0.0253669508, 0.2764599919, -0.1492096484, -0.3791152537, -0.0607023016, -0.1620898396, 0.1172119528, 0.2236528248, 0.043442037, -0.0240608975, 0.0903700963, -0.1618454754, -0.0048662769, -0.090556033, -0.1171321496, 0.0959540084, 0.3593364954, 0.1913872808, 0.0502059758, 0.359662801, 0.0885729566, -0.3440553546, 0.0759109706, -0.2765966058, -0.2300833017, 0.0411390923, 0.0753661469, 0.0709391534, 0.1175205335, 0.1291138828, -0.0899928808, -0.1023082808, -0.202532202, 0.0411028676, -0.0845113471, -0.0814069137, 0.5126655698, -0.0769249275, -0.3476969004, -0.0207589641, 0.4428582191, 0.2637455463, 0.0066060987, 0.1803854704, 0.1175712869, -0.0454969145, -0.2055633664, -0.2149386406, 0.2369130999, -0.2474358678, 0.2362891436, 0.0953163803, -0.2004565001, 0.2147381306, 0.0181346051, 0.0912797898, 0.3555854857, -0.208153069, -0.3337839246, -0.4716794789, 0.2893685102, 0.0941012129, 0.0819012597, -0.0503460392, 0.2005215287, -0.0628678426, 0.2897007167, -0.2136404663, 0.1265347451, -0.053728994, 0.2342291027, -0.1462180167, 0.0019320465, -0.1427264512, -0.1322261244, 0.068119362, -0.0060307998, -0.2096679211, -0.0245788153, 0.0344260111, 0.1419171989, 0.0874608234, -0.2029489279, -0.0352998376, -0.0580193847, -0.0988914073, -0.1757137626, 0.2244656682, 0.315364331, -0.1890924126, 0.1739249825, 0.2851650417, 0.1327939481, 0.0680402592, 0.3327767849, -0.2285960615, 0.0301886927, 0.0431797728, 0.4585476518, 0.070335865, -0.1614505649, 0.0679123551, 0.080925487, -0.0829219446, -0.0151951322, 0.3467743099, -0.2715688944, -0.0050470959, -0.069094874, 0.4576989114, 0.4409003258, -0.1034997329, 0.0886820853, 0.1568594128, 0.0879037827, -0.0480683148, -0.148917079, 0.5387003422, 0.1000272259, 0.0745917782, 0.2959094942, 0.3054136038, -0.1664315164, 0.2006228417, 0.1431750059, -0.0360420719, 0.0572848059, 0.1860658079, 0.2724134326, 0.1090568677, 0.256983161, 0.2660529315, -0.2749654949, -0.1071280465, 0.3567868173, -0.0522897169, 0.4890813529, -0.0663105696, 0.1197936013, -0.0846301615, -0.6104992032, 0.0734562352, 0.1625178754, -0.4453830719, 0.146336481, 0.0180165432, 0.313305378, -0.1979468614, -0.4583254755, -0.1947423965, 0.4319697917, -0.2319601625, -0.3544825613, -0.2850637734, -0.1753607839, -0.0590661988, 0.0898283198, -0.145472765, 0.1400509179, 0.799793303, 0.0538034961, -0.0667096302, -0.2466626465, -0.3139775395, -0.0052760812, 0.3108201325, 0.0006736608, 0.4508588612, 0.0546378642, -0.0182308499, -0.0618823767, 0.1523040682, 0.5050356388, 0.6981107593, -0.4474115372, -0.048005037, 0.1089006886, -0.0523091555, -0.0862673298, 0.3647114038, 0.1321835816, 0.3019935489, 0.296325326, -0.0656323284, 0.0374661796, -0.1313715875, 0.3382483125, 0.345251292, 0.0240486041, 0.3023180962, 0.0798643008, -0.1416295022, 0.2565797269, 0.0797429308, -0.3255622685, -0.1952850819, 0.5692191124, -0.4321992993, 0.2212006003, 0.1722596139, 0.0486827269, 0.1094023436, 0.5082311034, 0.3306358159, 0.1644893438, -0.2521735132, -0.1733622551, -0.4439536631, 0.0342983417, -0.1946022809, 0.3066214919, 0.0515657924, 0.0016594176, -0.0660621673, 0.0451494902, 0.0099887317, -0.193202883, 0.3324363828, 0.3729103506, -0.585285008, 0.2185811549, 0.0498896018, -0.0063309427, -0.0412898622, -0.3142338395, 0.3802555799, -0.0498874709, -0.1108641922, 0.0644590184, 0.1700888872, 0.1745330244, 0.2145897299, 0.0503832102, 0.2386428118, 0.5973000526, -0.0063548437, 0.0381643139, -0.2856546044, 0.0393656753, -0.1230393723, -0.0162282586, 0.0599050261, 0.3647587597, -0.1982249469, -0.0922027677, 0.0259150658, 0.2058886588, 0.0098138778, 0.2247242332, -0.3983497024, 0.1691612452, 0.2343988419, -0.0028141066, -0.2005939633, 0.3361579478, 0.1607358605, 0.303252995, -0.3313165605, -0.2211698741, 0.3441256583, -0.0998618826, -0.1244288385, -0.59441185, 0.1723877937, -0.171698153, 0.0901962221, -0.5051230192, -0.304591924, 0.2259379774, -0.1941107064, -0.5847125649, 0.2045533508, -0.0807115138, -0.1077305228, -0.085733287, -0.2042673677, 0.1254520118, -0.198326081, 0.1375616938, -0.1398176402 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Sorry, I just noticed this. I'm running this on MACOS the version of datasets I'm was 1.0.0 but I've also tried it on 1.0.2. `pyarrow==1.0.1`, Python 3.6 Consider this code: ```python loader_path = str(Path(__file__).parent / "prodigy_dataset_builder.py") ds = load_dataset( loader_path, name="prodigy-ds", data_files=list(file_paths), cache_dir=cache_dir )["train"] valid_relations = set(vocabulary.relation_types.keys()) ds = ds.filter(filter_good_rows, fn_kwargs=dict(valid_rel_labels=valid_relations)) ds = ds.map(map_bpe_encodings, batched=True, fn_kwargs=dict(tokenizer=vocabulary.tokenizer), num_proc=10) # add all feature data ner_ds: Dataset = ds.map( add_bio_tags, fn_kwargs=dict(ner_label_map=vocabulary.ner_labels, tokenizer=vocabulary.tokenizer), ) rel_ds: Dataset = ner_ds.map( relation_ds_factory, batched=True, writer_batch_size=100, fn_kwargs=dict(tokenizer=vocabulary.tokenizer, vocabulary=vocabulary), ) ``` The loader is essentially a jsonloader with some extra error handling. The data is a jsonlines format with text field and a list of span objects and relation objects. In the `ner_ds` a field, `ner_labels` is added, this is used in the downstream `relation_ds_factory`. It all runs fine in a single process but I get a KeyError error if run with num_proc set : ``` File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 348, in relation_ds_factory ner_labels = example["ner_labels"] KeyError: 'ner_labels' ``` This is just one example of what goes wrong. I've started just saving the dataset as arrow at the end because it takes a long time to map/filter/shuffle and the caching isn't working (tracked it down to byte differences in the pickled functions). ^^ Interestingly if I heed the warning from Tokenizers and set the environment variable, `TOKENIZERS_PARALLELISM=true` the map just hangs: ``` [I 200921 21:43:18 filelock:318] Lock 5694118768 released on /Users/timothy.laurent/.cache/huggingface/datasets/_Users_timothy.laurent_.cache_huggingface_datasets_prodigy_dataset_builder_prodigy-ds-5f34378723c4e83f_0.0.0_e67d9b43d5cd82c50b1eae8f2097daf95b601a04dc03ddd504f2b234a5fa247a.lock 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.34ba/s] #0: 0%| | 0/1 [00:00<?, ?ba/s] #1: 0%| | 0/1 [00:00<?, ?ba/s] #2: 0%| | 0/1 [00:00<?, ?ba/s] #3: 0%| | 0/1 [00:00<?, ?ba/s] #4: 0%| | 0/1 [00:00<?, ?ba/s] #5: 0%| | 0/1 [00:00<?, ?ba/s] #6: 0%| | 0/1 [00:00<?, ?ba/s] #7: 0%| | 0/1 [00:00<?, ?ba/s] #8: 0%| | 0/1 [00:00<?, ?ba/s] ```
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
289
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Sorry, I just noticed this. I'm running this on MACOS the version of datasets I'm was 1.0.0 but I've also tried it on 1.0.2. `pyarrow==1.0.1`, Python 3.6 Consider this code: ```python loader_path = str(Path(__file__).parent / "prodigy_dataset_builder.py") ds = load_dataset( loader_path, name="prodigy-ds", data_files=list(file_paths), cache_dir=cache_dir )["train"] valid_relations = set(vocabulary.relation_types.keys()) ds = ds.filter(filter_good_rows, fn_kwargs=dict(valid_rel_labels=valid_relations)) ds = ds.map(map_bpe_encodings, batched=True, fn_kwargs=dict(tokenizer=vocabulary.tokenizer), num_proc=10) # add all feature data ner_ds: Dataset = ds.map( add_bio_tags, fn_kwargs=dict(ner_label_map=vocabulary.ner_labels, tokenizer=vocabulary.tokenizer), ) rel_ds: Dataset = ner_ds.map( relation_ds_factory, batched=True, writer_batch_size=100, fn_kwargs=dict(tokenizer=vocabulary.tokenizer, vocabulary=vocabulary), ) ``` The loader is essentially a jsonloader with some extra error handling. The data is a jsonlines format with text field and a list of span objects and relation objects. In the `ner_ds` a field, `ner_labels` is added, this is used in the downstream `relation_ds_factory`. It all runs fine in a single process but I get a KeyError error if run with num_proc set : ``` File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 348, in relation_ds_factory ner_labels = example["ner_labels"] KeyError: 'ner_labels' ``` This is just one example of what goes wrong. I've started just saving the dataset as arrow at the end because it takes a long time to map/filter/shuffle and the caching isn't working (tracked it down to byte differences in the pickled functions). ^^ Interestingly if I heed the warning from Tokenizers and set the environment variable, `TOKENIZERS_PARALLELISM=true` the map just hangs: ``` [I 200921 21:43:18 filelock:318] Lock 5694118768 released on /Users/timothy.laurent/.cache/huggingface/datasets/_Users_timothy.laurent_.cache_huggingface_datasets_prodigy_dataset_builder_prodigy-ds-5f34378723c4e83f_0.0.0_e67d9b43d5cd82c50b1eae8f2097daf95b601a04dc03ddd504f2b234a5fa247a.lock 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.34ba/s] #0: 0%| | 0/1 [00:00<?, ?ba/s] #1: 0%| | 0/1 [00:00<?, ?ba/s] #2: 0%| | 0/1 [00:00<?, ?ba/s] #3: 0%| | 0/1 [00:00<?, ?ba/s] #4: 0%| | 0/1 [00:00<?, ?ba/s] #5: 0%| | 0/1 [00:00<?, ?ba/s] #6: 0%| | 0/1 [00:00<?, ?ba/s] #7: 0%| | 0/1 [00:00<?, ?ba/s] #8: 0%| | 0/1 [00:00<?, ?ba/s] ```
[ -0.3902371228, -0.0592107289, -0.0349890366, 0.2178633213, 0.1645163, -0.1262939572, 0.2920174003, 0.2759277821, 0.0126607586, 0.1588910967, 0.0277859829, 0.5151473284, -0.4663680196, 0.1931904107, -0.3737511635, 0.0636925325, 0.1268114597, -0.0707596764, -0.2591290176, 0.2371896654, -0.2843746543, 0.2678748071, -0.3191681504, 0.1325836331, -0.471380353, 0.0843235478, -0.0683147162, 0.3312542737, -0.0138634546, -0.58068645, 0.3135136366, 0.2603117824, 0.0385843217, 0.4804732502, -0.0001283317, 0.1993657351, 0.3485917151, -0.0834869742, -0.1267861277, -0.4279056191, -0.1911365837, -0.1817949563, 0.371966958, 0.0618709549, 0.2269575447, 0.065886192, -0.1034058705, -0.2707560658, 0.2035181969, 0.47746858, 0.0735511258, 0.2868753672, 0.2374197692, 0.1393540651, 0.1045712754, 0.2273841202, -0.0284488611, 0.154657647, 0.3186120987, -0.3993646502, -0.0570379607, 0.2126242816, -0.2640067041, -0.1909926087, -0.1678400338, -0.1613081843, 0.6544433236, -0.5508722067, 0.1051120833, 0.0620829426, -0.2794812918, -0.0378320217, -0.4952347875, -0.2726465762, -0.202734828, -0.4610622525, 0.2794249952, 0.1045864448, -0.1968157887, 0.1120818779, -0.5338084698, -0.1942972094, -0.047032278, -0.0213962458, -0.1469762474, 0.4835236669, 0.2019268423, 0.3012485206, 0.2571429014, 0.1812761575, 0.2967937291, -0.0528956093, -0.0266065132, 0.1361511052, -0.3973772526, 0.1082417965, 0.0853553861, -0.0201199483, -0.2698211074, -0.1237292588, -0.2139740437, 0.0115729123, -0.122290805, 0.0902780369, 0.4019183815, -0.1053704023, 0.1600661725, 0.3277311921, 0.2415082902, -0.1646748632, -0.0319321901, 0.049474217, 0.3143289387, -0.0866266489, -0.0327450708, 0.2530673444, 0.1316753328, -0.1706767231, -0.2822542191, 0.1109132096, -0.1060238108, -0.197737202, 0.0632684603, 0.1860612929, 0.0114507526, 0.7769073248, 0.1179553494, 0.2578347623, -0.3525594175, -0.0100728692, -0.0376886949, -0.0341650955, -0.3728174269, 0.1222596318, 0.1942778975, -0.0074803019, -0.0251635797, 0.0497133397, -0.3763317466, -0.2689580619, 0.0794304609, -0.2373994589, 0.0149760526, 0.6824305058, -0.1149508879, 0.0577008836, 0.0015730766, -0.0498104356, 0.0627912283, 0.3190524578, -0.4979270399, -0.1897996068, -0.2720980644, 0.0515525602, -0.052785445, 0.2867565751, -0.149630338, 0.1937613338, 0.4530758858, -0.3586956561, -0.2541365027, -0.3936059773, -0.3620464504, -0.3363009691, -0.0959209204, 0.291657567, -0.4016877711, -0.0132423323, -0.001704332, -0.199328959, 0.3723532557, 0.1838978827, -0.0308999773, 0.0506744161, -0.1230263561, 0.060329657, 0.1363580674, -0.1564812511, -0.1171425134, 0.2111738175, 0.0261727795, 0.3385827541, -0.0083542243, -0.2690427303, 0.2257902473, -0.1163294092, 0.1201394871, -0.0425292291, -0.1851773262, 0.0972475857, -0.3684076071, -0.0858111456, -0.0229808893, 0.0099369558, 0.3281297982, 0.2012066692, -0.0785201266, -0.5475060344, 0.3592302799, -0.1374181211, 0.2546220124, 0.11852099, 0.0758695751, 0.1038609892, 0.0685259551, -0.3592194617, -0.4807923734, 0.1885323822, -0.2075804025, 0.0658969581, -0.193608284, -0.0030007288, 0.1345408857, 0.2470801473, -0.2068517506, -0.1502072066, -0.0093077207, 0.0411524847, -0.2690401077, -0.0091309678, -0.2266807705, 0.5915706754, 0.1010034978, 0.1743610352, -0.1415228844, 0.2607126534, -0.1526126117, -0.4264979362, -0.2687479258, 0.1833891869, -0.0396081731, -0.101426959, -0.2160594314, 0.4433248043, 0.5269333124, -0.0824614614, -0.1035685465, 0.0848544985, 0.2232706547, -0.1494115442, -0.1771422774, 0.0278936345, 0.0121734459, -0.1099252477, 0.1677223444, 0.4997615218, 0.1795993, 0.4273736179, 0.1819783449, 0.2141727805, 0.23389557, -0.0310658012, 0.075888142, -0.1896803975, 0.2151063234, -0.0762620419, 0.1706491113, 0.0909811556, -0.1406538635, -0.1778079569, 0.1783762127, -0.0294321831, -0.2232915163, 0.1606330425, 0.1228897646, -0.0887502283, 0.1456645727, 0.0523059592, 0.5058745742, -0.0183925517, -0.1601222605, 0.179027155, -0.2569558322, -0.0544665754, 0.1409520209, -0.0223163348, 0.4753068984, 0.2240649909, 0.1380570382, 0.0309251826, -0.1429343373, -0.3365240395, 0.1123441532, 0.4086907208, -0.5074978471, 0.2802316248, -0.281306982, 0.3557099104, 0.1002072319, -0.1912258267, -0.3339082599, -0.574213028, -0.1533736289, 0.5668951273, -0.0479358695, 0.1126047373, 0.0036665231, 0.0170779265, -0.1395085156, 0.2880709767, -0.1432928592, -0.291698575, -0.1898861676, -0.1433071345, 0.3513782024, -0.3711666167, 0.1469881833, 0.1352251917, -0.2889914811, 0.1344394833, -0.2641729712, 0.0789275914, -0.0919096246, 0.049419824, 0.1642391235, -0.0096583525, 0.0157180447, -0.1921669245, 0.1474490762, -0.1172630936, -0.2671200931, 0.2706720829, -0.0943268016, 0.1018958911, -0.2709845603, -0.241150558, -0.4557648003, -0.1072816774, -0.0832761377, -0.27243343, 0.4007446766, 0.0954070613, 0.1183815375, -0.0040318472, -0.1268735379, 0.0669993088, -0.0192439184, -0.1305204034, -0.1743674129, 0.0603601262, -0.1189939752, -0.0972296, 0.0485862568, 0.1815911084, 0.4506171346, -0.4062319994, 0.0196713209, 0.0632364303, 0.0106000388, 0.180007115, -0.0984766781, 0.3727630377, 0.4366260767, 0.0714965016, -0.0349687971, -0.1571934521, 0.0263093282, -0.010599657, 0.1163600385, 0.1012198851, 0.3563603759, 0.0692335144, 0.6154004931, 0.3028968573, 0.0240009036, 0.4207400084, -0.1140318215, 0.1770392656, -0.1278585494, -0.388690263, -0.2190793306, -0.2585810423, -0.0364084132, -0.1498001963, -0.1143198982, -0.4521028101, -0.3066712022, 0.5371507406, -0.396317482, -0.2275894433, -0.0357148685, -0.5229923129, 0.3197064996, -0.1332029551, 0.0923332348, -0.0210316777, -0.0123196756, -0.2608735859, 0.1982912868, 0.1756757349, -0.3334378898, -0.1989692152, -0.2547501326, -0.423569113, 0.279632628, 0.2617284954, 0.6507917643, -0.0224347264, -0.0912633613, 0.0490728766, -0.1589069217, 0.9467085004, -0.5530067086, -0.3837415874, 0.3207136989, -0.3916182816, -0.4114246964, -0.1919740438, -0.168203786, 0.5057574511, 0.4449553192, 0.4266182482, -0.1363420635, -0.2412994206, 0.1054762602, -0.1660164446, -0.0559677556, -0.110016413, -0.3457888961, -0.0248542782, -0.2040705085, 0.0148851052, -0.2748689651, 0.1367736906, -0.2351040095, -0.0453105047, -0.106562078, -0.0417624488, 0.2391810268, 0.0945945084, -0.062073458, -0.2242543399, 0.0294655301, 0.036441762, 0.0655655116, 0.3162382543, 0.3880429566, -0.4297847748, -0.2748395205, 0.1313021183, 0.0363298431, 0.3011682332, 0.2805289626, 0.2016387135, -0.0545179136, 0.0339006707, 0.1890443414, -0.2018798292, 0.0521093756, 0.375320226, -0.0061679306, -0.5099651217, -0.1230169162, -0.0394014195, 0.4427993298, -0.1759001017, 0.4935837388, -0.4076268077, -0.2237098515, 0.3691268265, 0.1325163841, 0.8098663688, -0.3974614143, 0.0769532099, 0.1735077351, -0.0470372252, 0.186383158, 0.098289676, 0.0292268004, -0.2433082014, 0.0711705834, -0.0831507221, 0.0216639172, 0.3116820455, 0.2036144137, -0.1217255816, 0.3935732543, -0.0482354499, -0.1080325246, 0.0144363502, 0.1247012839, 0.4162152112, -0.0682364851, 0.0542990007, -0.0463159755, -0.0153230019, -0.168632552, 0.0636391491, 0.037789382, 0.2080997676, -0.0833261237, -0.3949979246, -0.0183963086, -0.1994372159, 0.1233621389, 0.2540485263, 0.0323193409, 0.000421272, 0.1316601038, -0.1175601259, -0.0195804741, -0.0541592576, -0.1245339736, 0.1197447777, 0.3622775376, 0.1966810971, -0.0266353134, 0.3706838489, 0.1262274534, -0.2895877063, 0.0818762258, -0.2871004045, -0.3017194271, 0.0900713205, 0.1001077294, 0.0619030409, 0.0978556126, 0.1198111475, -0.1417672932, -0.0813700482, -0.1729370058, 0.0055496274, -0.0217465535, -0.0733128265, 0.521982193, -0.1842381656, -0.4113765657, -0.0405903459, 0.4757856429, 0.2396561801, -0.0272112507, 0.1421352476, 0.1073059738, -0.0383117944, -0.1914339513, -0.1821703613, 0.161919415, -0.1182457432, 0.3026515543, 0.1182361245, -0.1970132589, 0.2240916342, 0.0110585876, 0.0495455265, 0.3996918797, -0.2089021802, -0.4455859959, -0.4509822726, 0.149669081, 0.0523026101, 0.0951906294, -0.0578682423, 0.134649381, -0.0781705827, 0.2322916389, -0.1699384451, 0.1046630219, -0.0788070634, 0.1839053035, -0.0657353774, -0.0033373574, -0.0813560337, -0.1864002198, 0.0610802807, -0.0536474623, -0.1819945276, 0.0190771725, 0.0090598194, 0.1597507149, 0.0806202888, -0.1893983334, -0.0404152386, -0.1286810338, -0.0983984247, -0.1971828192, 0.1859803349, 0.2965233028, -0.2234842032, 0.1309631914, 0.1407271326, 0.139110744, 0.1234746575, 0.2911404967, -0.2618761361, 0.08127556, 0.0843400508, 0.4735643268, 0.1265993565, -0.1444475502, 0.0068723462, 0.0722141936, -0.0797408223, -0.0387322046, 0.3153669238, -0.2142033577, 0.0150713511, -0.0385253169, 0.4274142385, 0.4411701858, -0.1120111048, 0.0696167424, 0.1674492359, 0.0414150357, -0.00656687, -0.1578635871, 0.4595558047, 0.1683234721, 0.0615441538, 0.3693101108, 0.2341261804, -0.1762969494, 0.2079517245, 0.1163487062, 0.0093933865, 0.1069401279, 0.2281329632, 0.205507502, 0.0888194814, 0.2472231239, 0.2893258333, -0.2717822194, -0.1593870223, 0.320710063, -0.0138617977, 0.548751533, -0.1250103116, 0.0803009123, -0.0502974875, -0.6033815742, 0.0717618465, 0.0658149198, -0.4713744521, 0.1535798162, -0.031970229, 0.2851430178, -0.3424895108, -0.4615471959, -0.1285653859, 0.4549019635, -0.2151288837, -0.2811869979, -0.2522724867, -0.1286939979, -0.0143392617, 0.0968539044, -0.0987996161, 0.0768011063, 0.8586913943, 0.1223395839, -0.0633002445, -0.2654589713, -0.3154935837, -0.0107819568, 0.3119972944, -0.0386176221, 0.4298150837, 0.0076610795, 0.021152446, -0.0095242793, 0.0986581668, 0.5285562277, 0.702031672, -0.4172755778, -0.0881650373, 0.040284697, -0.0154565303, -0.0769824982, 0.3674936593, 0.0732597187, 0.4442250133, 0.3028240204, -0.0867996588, 0.0544059165, -0.1054819524, 0.3087967336, 0.3557133675, 0.0208870377, 0.3362545371, 0.0463116802, -0.1064683795, 0.1838287115, 0.0949916989, -0.3379244506, -0.2214140892, 0.5490169525, -0.3919816911, 0.234620437, 0.184906885, 0.0182023346, 0.099883683, 0.4574813843, 0.390499264, 0.2112108469, -0.2984004915, -0.22969082, -0.4322272539, 0.0492716581, -0.2420559376, 0.1895723492, 0.0139315734, -0.0174991675, -0.0689752474, 0.0357956514, -0.0441639461, -0.1033585891, 0.2798514962, 0.3125053346, -0.5940951705, 0.119491525, 0.0456100628, -0.0892165378, -0.0052898275, -0.2988870442, 0.3827373087, -0.0838379562, -0.1470668316, 0.0633485019, 0.1591053903, 0.058298301, 0.2646427751, 0.0672972649, 0.2498592287, 0.5691512227, 0.0288305432, -0.0433513783, -0.285592407, 0.0926690027, -0.1503720433, -0.028702395, 0.0138798505, 0.4206103086, -0.2453808635, -0.0113224592, -0.0500105731, 0.2309752554, 0.0593191087, 0.1608804017, -0.3077151775, 0.1874891967, 0.2092628479, 0.0709562153, -0.1115402281, 0.2920915782, 0.1933351606, 0.3580842018, -0.3929082155, -0.17999354, 0.3470679224, -0.1066254079, -0.1602694392, -0.4940541983, 0.1251232326, -0.223012358, 0.1019253135, -0.6306143403, -0.322309643, 0.2625124454, -0.2387554199, -0.5590649843, 0.1612030864, -0.0511403456, -0.1086176708, -0.1057395265, -0.14616552, 0.0927547291, -0.147059232, 0.18501921, -0.1125659347 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
#659 should fix the `KeyError` issue. It was due to the formatting not getting updated the right way
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
18
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` #659 should fix the `KeyError` issue. It was due to the formatting not getting updated the right way
[ -0.3512131572, -0.1855429113, -0.0195905492, 0.2103055567, 0.1381860971, -0.1670842767, 0.2795543671, 0.3684957027, 0.0815792978, 0.1086879745, 0.0889101028, 0.3803418577, -0.4003905654, 0.4001257718, -0.3610643446, -0.0263171792, 0.1120805666, -0.011387445, -0.3007358611, 0.2906779051, -0.2718745768, 0.2635472715, -0.3654165566, 0.1494774669, -0.5365363955, 0.0468140654, -0.1020093709, 0.2186749279, -0.0090192985, -0.6350336075, 0.3107408583, 0.2939073741, -0.0312146693, 0.4254749119, -0.0001246411, 0.1012202278, 0.3174882829, -0.1645225585, -0.0690911859, -0.2924406528, -0.2228092253, -0.2399375141, 0.2814206481, 0.1030043438, 0.1462617368, -0.0645409822, -0.1684449017, -0.1902515143, 0.2530601025, 0.3587377369, 0.1109459028, 0.1981877834, 0.3393388987, 0.1626253575, -0.0395517908, 0.1583106071, -0.0288628452, 0.0209669825, 0.3021857738, -0.2966940701, -0.0835428834, 0.3755782843, -0.2106484175, -0.2462289631, -0.0806412771, -0.2204285264, 0.623047173, -0.5610297918, 0.1792760491, -0.0036663932, -0.1783302128, 0.0002158493, -0.4601680338, -0.2397007793, -0.2292336524, -0.4920297563, 0.2561890483, -0.0092998305, -0.1389593929, 0.1675009578, -0.4596164823, -0.2790910304, -0.079325527, -0.0925054029, -0.0451418869, 0.5593506694, 0.1581874341, 0.2434732914, 0.0868085548, 0.1045116186, 0.1365902573, -0.0745361671, -0.1486056, 0.1676542312, -0.3396681845, 0.058059074, 0.0380164571, -0.0539466031, -0.2356517464, -0.0823006928, -0.1954456866, 0.1293755621, -0.0923481807, -0.0000642306, 0.42779845, -0.065158464, 0.3168874085, 0.2542017102, 0.2367104292, -0.2161653191, 0.0550286658, 0.0133822486, 0.3371008635, -0.1049288064, -0.016228592, 0.3913570046, 0.1192444786, -0.1721611172, -0.1057620943, 0.1788408607, -0.0347321481, -0.2633395195, 0.0211246703, 0.1464975923, 0.0519357212, 0.7958670855, 0.1379259229, 0.1675081849, -0.3039817512, -0.0909312442, -0.0441624112, -0.0180008207, -0.4197020829, 0.0411579981, 0.2246311307, -0.0470210426, -0.0232575722, 0.0513087325, -0.3942950964, -0.2987013459, 0.0350017287, -0.2101653963, 0.1784783155, 0.6543557048, -0.1317067891, 0.097931765, -0.036475867, -0.1969342381, 0.0777078122, 0.2401848137, -0.5455411673, -0.1287515759, -0.2255557328, 0.0737909302, 0.0727314949, 0.3116742969, -0.136751309, 0.2338907272, 0.4383323491, -0.3816611171, -0.2752709091, -0.3559554219, -0.3625253737, -0.3146936595, -0.0502028055, 0.3140788078, -0.4769178033, -0.0701623559, 0.1530878693, -0.1712599546, 0.3403359056, 0.1905315518, 0.0236394554, 0.0471596569, -0.1083850041, 0.1005760953, 0.1277478933, -0.2211736888, -0.1791698784, 0.3235464692, 0.0132384347, 0.3650312126, 0.0487263985, -0.2932930887, 0.3140541315, -0.0850168094, 0.2829433978, -0.1017532125, -0.1259892881, 0.0704032108, -0.4282627702, 0.0150120426, -0.0669374615, -0.1675519794, 0.3579864204, 0.1379957795, -0.2026560307, -0.475399375, 0.3315639496, -0.1146085411, 0.3142383397, 0.0391068272, 0.0674776733, 0.0599835962, 0.1719401032, -0.2382498682, -0.4738482237, 0.1375686228, -0.2226946354, 0.0047202804, -0.1448162049, 0.0010652369, 0.0444620512, 0.1925702542, -0.2922157049, -0.24920398, 0.0417657532, 0.0107116476, -0.3038725853, -0.0823197216, -0.184363246, 0.5929728746, 0.2195536494, 0.1409042925, -0.0882687271, 0.1312268674, -0.2019504905, -0.4209198952, -0.2407812327, 0.2778550684, -0.0094550755, -0.1175535843, -0.2070065588, 0.5246532559, 0.5095105767, -0.1137294769, -0.142915681, 0.1915372461, 0.2684915066, -0.0770461783, -0.1743261367, 0.0702149644, 0.0227085575, -0.1169540361, 0.0810189024, 0.5475667119, 0.0962423757, 0.4146908224, 0.1494486779, 0.245274052, 0.2949584723, 0.0570026003, -0.0602540448, -0.2418471426, 0.1514018029, -0.2580645084, 0.1053333431, 0.0012401619, -0.1381931305, -0.1894833893, 0.1466968954, 0.1051098853, -0.1097240373, 0.0170609262, 0.0435085259, -0.1117243692, 0.0992230773, 0.0218311343, 0.3506157994, 0.0209108256, -0.2784489691, 0.1740035564, -0.1862995028, -0.0493127406, 0.138751775, -0.0766850188, 0.3364537656, 0.3832505345, 0.0561588258, 0.0106230723, -0.1192150488, -0.2493801117, 0.0324691273, 0.3667414486, -0.5073885918, 0.2152487189, -0.2861205637, 0.2549753785, 0.042119734, -0.1092757434, -0.192658633, -0.572933197, -0.1137758568, 0.420991838, -0.0548843406, 0.148354426, -0.0123482756, 0.0344809815, -0.1731373519, 0.3812191784, -0.1331989318, -0.3283344209, -0.1470114291, -0.1047791839, 0.3488056362, -0.3240472376, 0.2100391835, 0.0738012269, -0.1691032201, 0.2368294001, -0.334237963, 0.1082953289, -0.0472084247, -0.0064861109, 0.1615284234, 0.0518071689, 0.0494499877, -0.2052885145, 0.1594747454, -0.1578567922, -0.2601368129, 0.310146749, -0.1496080756, 0.1178079918, -0.2731793821, -0.3018986285, -0.3529524207, -0.0495849699, -0.0805209503, -0.2224939466, 0.3450750113, 0.1496510506, 0.0659471974, -0.0863050595, -0.129886508, 0.0984946266, -0.0306525026, 0.0026159834, -0.1935721487, 0.0507385693, -0.1470983773, -0.0774887428, 0.076076068, 0.0738084316, 0.3409606218, -0.2849747539, 0.0146594858, 0.0951364115, -0.1259044558, 0.2607453465, -0.1134286225, 0.3486635387, 0.4518113136, 0.0555606447, -0.048673708, -0.165944159, 0.0462608561, -0.0057880892, -0.0026092215, 0.1092261747, 0.3223179281, 0.1327677071, 0.6104080081, 0.3465014994, 0.1186997369, 0.3046036065, -0.111874789, 0.1353438199, -0.2403229177, -0.3785363436, -0.2232076675, -0.2772704661, 0.0575736463, -0.1354534179, -0.1057831869, -0.3906253278, -0.296254307, 0.486823082, -0.426826179, -0.2603372931, 0.0627298057, -0.5000076294, 0.2818247974, -0.0854156613, 0.143267706, -0.041168537, -0.0294574145, -0.223872453, 0.1939019263, 0.1314988583, -0.3822317421, -0.2747118175, -0.3799424171, -0.472422868, 0.3566467166, 0.2372459918, 0.7411820889, 0.0431602299, -0.0587892644, 0.028300751, -0.1665700674, 0.873999238, -0.6421239376, -0.4028037786, 0.2552216649, -0.4388189912, -0.2836793661, -0.2003702819, -0.2084670812, 0.624574244, 0.3335074484, 0.5355912447, -0.1612277627, -0.3011720479, 0.1604254097, -0.1607854515, -0.1677838564, 0.0375810452, -0.315436244, 0.0333146825, -0.2019891739, 0.0484581888, -0.3043011427, 0.1444119662, -0.1331545413, 0.0173655637, -0.0812013671, -0.0779057443, 0.1874221861, 0.0885716602, 0.0324917212, -0.1064601466, -0.0421273671, 0.0955707356, 0.1971702576, 0.2318535596, 0.219666034, -0.4627839327, -0.0665590614, 0.1394234598, -0.1067317426, 0.3257447481, 0.3188472986, 0.2260961235, -0.0660922974, 0.0870820582, 0.1652500331, -0.3262059391, -0.0555947423, 0.396692872, -0.0314927362, -0.5680360198, -0.2148531526, -0.1295143515, 0.3982083499, -0.2285054177, 0.4416517615, -0.3164744675, -0.2612660825, 0.4667616189, 0.0664018318, 0.8066740036, -0.3608475327, 0.0161100905, 0.0260821898, -0.0325377211, 0.1356403381, 0.0996827334, 0.0458450429, -0.3653548658, -0.0213855226, -0.0681433305, 0.065667443, 0.2799922824, 0.1120458022, -0.2234570682, 0.4462039769, -0.0944938958, -0.0914894342, -0.0715276152, 0.1839325279, 0.4588895738, -0.0594942309, 0.0677260607, -0.0470556132, -0.0335691199, -0.1416147649, 0.0173166674, 0.0303137228, 0.2864642441, -0.2391977906, -0.4589388669, -0.1258006394, -0.0731940567, 0.0951597318, 0.1623538882, 0.0272922721, -0.0312511437, 0.1535905004, -0.0549029447, 0.1623503119, -0.0921655223, -0.143630594, 0.072174333, 0.3353672028, 0.1709640175, 0.0916817114, 0.3252387643, 0.1279742867, -0.2073791176, 0.0669179037, -0.2403381169, -0.1906893253, 0.0515944324, 0.0379663669, 0.026699055, 0.0648268834, 0.0511721112, -0.0490259603, -0.0993205309, -0.201346159, 0.039368324, -0.0495409444, -0.0926296562, 0.5310729146, 0.0182948932, -0.3574021459, 0.0256604906, 0.4819169641, 0.287112534, -0.0772085264, 0.231432423, 0.1426068544, -0.0611015521, -0.2567399144, -0.1564755887, 0.2738889456, -0.1716050059, 0.2461798191, 0.091036804, -0.1785513312, 0.1953547448, 0.1071568727, 0.1189330444, 0.3926023245, -0.2192412019, -0.337838918, -0.4110482335, 0.2427577078, 0.1089819148, 0.0621585548, -0.1027741581, 0.1274103373, -0.1135091186, 0.3102333248, -0.2243909836, 0.0437064432, -0.0038378399, 0.2115469426, -0.0914864093, 0.0675678849, -0.1171538681, -0.1400816143, 0.064386569, 0.0095131593, -0.1756790429, -0.0247320719, 0.0113602206, 0.1218328997, 0.0662020221, -0.1837545037, -0.0681136176, 0.0006088443, -0.0888131708, -0.2294077575, 0.1706519425, 0.3239958882, -0.1849399805, 0.2520670295, 0.1697710901, 0.1847814173, 0.0892376825, 0.3003497124, -0.2528879344, 0.088892214, 0.0715163127, 0.4085337222, 0.084813334, -0.1983521134, 0.0351341106, 0.176411584, -0.1393330693, 0.0583750457, 0.2958630621, -0.251965791, 0.0858206898, 0.018224813, 0.4392741323, 0.4068155587, -0.1030400842, 0.1577363461, 0.0806599259, 0.0935270935, 0.0447810255, -0.2281360775, 0.5149975419, 0.0612496808, 0.0703288093, 0.3585090637, 0.3325627446, -0.1416946203, 0.1496497989, 0.1260898858, -0.1130566224, 0.0080725467, 0.1593116522, 0.3051336706, 0.1120932475, 0.2470810562, 0.2925590277, -0.2948815227, -0.1773037612, 0.2537922263, 0.0569481477, 0.4753107429, 0.092465058, 0.1063256934, -0.1624212414, -0.6658923626, 0.1066897735, 0.0673349053, -0.4565560222, 0.2207166851, 0.0476553179, 0.2264573574, -0.3147782385, -0.4356146753, -0.1328766346, 0.3830536008, -0.2740249336, -0.3404760659, -0.2711841166, -0.1706430316, -0.0961933658, 0.0628361925, -0.1690144837, 0.2519635558, 0.7469225526, -0.0266132746, -0.0577593818, -0.1461753696, -0.3229095042, -0.072254613, 0.4131662846, -0.0892193094, 0.3782849908, 0.05708839, 0.140182361, 0.0034946911, 0.1684926301, 0.475854665, 0.6625869274, -0.476247102, -0.0825555697, 0.0828101188, -0.1063215882, -0.0610714853, 0.4503815472, 0.0963013694, 0.2951025069, 0.3415160179, -0.0530047901, 0.0091973385, -0.1055935845, 0.3893707693, 0.3519671559, 0.1573841125, 0.2242007554, 0.0683894902, -0.1439944506, 0.2735782564, 0.0962111503, -0.3139978647, -0.3135895133, 0.4868748188, -0.3782310188, 0.2376130372, 0.1878692806, 0.0577967539, 0.1757683754, 0.5463713408, 0.3670719862, 0.1067021042, -0.2591426075, -0.166255936, -0.3945916593, -0.0790592209, -0.1534976512, 0.2001520395, -0.042551443, -0.0055499529, 0.0010904743, 0.0817843154, -0.0310584251, -0.2819317877, 0.2874448001, 0.3652770817, -0.555668056, 0.2423668653, 0.1740243286, -0.0015554845, -0.0395296402, -0.2589580417, 0.3855099976, 0.0197240021, -0.067719698, 0.073588118, 0.1376983374, 0.0231757704, 0.1443934292, -0.0157721769, 0.2998053432, 0.6039765477, -0.049515862, -0.0536487065, -0.2163184434, 0.0924264938, -0.1226852015, 0.0438341722, 0.0929372907, 0.5019168854, -0.1521148384, -0.0962428078, 0.0546567142, 0.214031443, -0.0115537699, 0.2152944654, -0.4327303767, 0.2691526115, 0.2196225971, -0.0632072687, -0.1603736728, 0.4091358781, 0.1511184722, 0.2834833264, -0.2557685375, -0.1834850311, 0.216273278, -0.0245579034, -0.1608246416, -0.5821933746, 0.167862311, -0.1972019225, 0.1791552454, -0.4916590452, -0.2939210236, 0.1788069308, -0.1754195988, -0.5868236423, 0.2050279677, -0.1429531425, -0.1216798946, -0.0698917806, -0.1655351073, 0.0962967724, -0.1347574443, 0.0342642106, -0.0679897964 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Also maybe @n1t0 knows why setting `TOKENIZERS_PARALLELISM=true` creates deadlock issues when calling `map` with multiprocessing ?
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
16
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Also maybe @n1t0 knows why setting `TOKENIZERS_PARALLELISM=true` creates deadlock issues when calling `map` with multiprocessing ?
[ -0.4357658327, -0.1091971248, -0.0417286903, 0.2121775001, 0.0695554987, -0.1265097558, 0.2546489239, 0.3328147233, 0.1938225776, 0.121943973, 0.1160635054, 0.4567502439, -0.4093025029, 0.2884694934, -0.3752996624, 0.0169865582, 0.0992288142, -0.0942485482, -0.3434426785, 0.2482094914, -0.2782727182, 0.2710520327, -0.3459439278, 0.1593250483, -0.535322845, 0.0872886926, -0.003973749, 0.2528879642, -0.0188717078, -0.5731793642, 0.2949807644, 0.2831942439, 0.0004403551, 0.4602256715, -0.0001217121, 0.1132882237, 0.3699004948, -0.0942806154, -0.0318262801, -0.3821790516, -0.2222521007, -0.2362089306, 0.2945428193, 0.103973031, 0.216194734, 0.0128662931, -0.077256158, -0.2985164821, 0.1986687332, 0.372841388, 0.1237755939, 0.2111011595, 0.2978758812, 0.1220002323, -0.0423815176, 0.1499401331, -0.0497976877, 0.0485661179, 0.344838798, -0.3739499152, -0.1388046443, 0.279615283, -0.2362972647, -0.1811296195, -0.1206906438, -0.240020439, 0.6395820975, -0.5958402753, 0.1814056635, 0.0657546297, -0.260902524, 0.000629256, -0.4477958381, -0.1799361855, -0.2648524046, -0.4586627185, 0.2208006382, 0.021816181, -0.1726400405, 0.1386403441, -0.525196135, -0.2143579423, 0.0352451839, -0.054474093, -0.0366727114, 0.532366097, 0.2305610478, 0.3113504052, 0.1949433535, 0.1283582896, 0.113835603, -0.0167993754, -0.0804867297, 0.1571735889, -0.4042960405, 0.101692535, 0.137258634, -0.1121083349, -0.2406968325, -0.0560519062, -0.1629003733, 0.0969964564, -0.0776490867, 0.0668470412, 0.4337725937, -0.133866936, 0.1751342863, 0.2501193285, 0.2519486547, -0.2092770934, 0.0151373511, 0.0317403935, 0.3243443668, -0.1119964719, -0.0390040353, 0.3069898486, 0.0965449139, -0.1498589069, -0.159279868, 0.0878243074, -0.1078609079, -0.2057655305, 0.1011890098, 0.1439218074, 0.0724173188, 0.7728216052, 0.1620065421, 0.1372259408, -0.3340583444, -0.0898870304, -0.0551430993, -0.0666495711, -0.4002194703, 0.1255268753, 0.2563380599, 0.0599527098, 0.0080618337, 0.041939579, -0.3320830762, -0.2169156522, 0.1727741808, -0.276620537, 0.0906435326, 0.6310878396, -0.0971725732, 0.0243760329, -0.0824456215, -0.0286204163, 0.0511687957, 0.2955012619, -0.5336505771, -0.1557148993, -0.1656826138, 0.1078609228, 0.0666462481, 0.3060179055, -0.1915568262, 0.2547093034, 0.3675670624, -0.3739644587, -0.2680079639, -0.32388708, -0.4069842994, -0.3038038909, -0.0046003293, 0.2971155047, -0.3287831247, -0.0234115124, 0.0687610731, -0.2095828205, 0.27841115, 0.2272229046, -0.0418691859, 0.0260138847, -0.1166270748, 0.1641642898, 0.0441027693, -0.2357020676, -0.0901373774, 0.2893679142, -0.0088905143, 0.329949528, -0.0470987745, -0.2168495506, 0.3346088529, -0.1311824769, 0.2851606011, -0.0148701128, -0.1969218999, 0.1048755869, -0.4357782602, -0.0461990722, -0.0751762837, -0.0823952109, 0.3545597792, 0.1582434773, -0.1317894757, -0.472471118, 0.2870238125, -0.0712430328, 0.3042714298, 0.0659306943, 0.0621416867, 0.057361044, 0.1319962889, -0.2830130458, -0.5129542947, 0.1994396746, -0.2078191787, -0.0241886657, -0.0505438149, 0.015270533, 0.1672005504, 0.1793142408, -0.1974951178, -0.1488043666, 0.0632103905, -0.0676077157, -0.2822648585, -0.0553282984, -0.1842778176, 0.649266839, 0.1441820115, 0.0867222697, -0.0818904266, 0.2211701572, -0.1520407945, -0.440872401, -0.2989483774, 0.2226272225, -0.0454037376, -0.071613133, -0.2133348584, 0.4630849361, 0.4911285937, -0.0391309112, -0.0376372077, 0.1667610109, 0.2644602358, -0.1828806549, -0.1570649892, 0.1237260997, 0.0492205918, -0.1837460846, 0.2333983779, 0.4180729985, 0.083604373, 0.3880742192, 0.2444255352, 0.2387425005, 0.2779891491, 0.0294541121, -0.0278629251, -0.1282213479, 0.212402299, -0.1187336296, 0.1564512551, 0.0764603987, -0.0925446823, -0.2441880703, 0.1627017558, 0.0704162195, -0.1369761974, 0.0474277511, 0.0893532932, -0.1253043711, 0.1578324437, 0.0026261248, 0.4480132163, 0.0147289326, -0.1836159527, 0.1479920298, -0.2042003274, -0.0055108313, 0.0887258202, -0.0780101046, 0.407810092, 0.2825420499, 0.0658048317, -0.0059384974, -0.1520560831, -0.3619621396, 0.119462721, 0.3093266487, -0.4322057664, 0.1622131914, -0.2236522436, 0.3789777458, 0.140934065, -0.1527127326, -0.267988801, -0.5417197943, -0.1163036302, 0.5250688195, -0.1006802097, 0.1325860173, -0.0776597187, 0.0356066637, -0.2600833476, 0.3981773853, -0.1304369718, -0.3576633632, -0.1955151409, -0.0964716151, 0.3104199767, -0.2298810631, 0.2243641019, 0.159036532, -0.2553643584, 0.1742384136, -0.246335566, 0.0499618798, -0.0595835708, 0.0070893029, 0.1035202444, -0.0094829472, 0.0074035684, -0.1684112698, 0.1527902484, -0.179636091, -0.2490495741, 0.2781175971, -0.1366074979, 0.077483885, -0.2758556306, -0.3428673744, -0.4242913127, -0.1626052558, -0.023146715, -0.2679259181, 0.3306128681, 0.0996189341, 0.0179552138, 0.041537974, -0.0787679553, 0.0687172785, -0.0472170599, -0.0622542314, -0.2065601796, 0.045468729, -0.1702644974, -0.0546776801, 0.1007058546, 0.0798725486, 0.4131043255, -0.2472679168, 0.0766094774, 0.0603867546, -0.0629384145, 0.2250363529, -0.1975023746, 0.3669516742, 0.3852900267, 0.0340522304, -0.0286279339, -0.1490009427, 0.1410464495, 0.004707186, -0.0262566637, 0.1507268399, 0.309121877, 0.1691417247, 0.6082265973, 0.3968892395, 0.0640839934, 0.3936432302, -0.0730803758, 0.0929010734, -0.2089507729, -0.3948880732, -0.2156743705, -0.2659688294, -0.0087277917, -0.2322267145, -0.1142553836, -0.4359851778, -0.3072882891, 0.5583676696, -0.361369282, -0.2352522463, -0.0361663438, -0.4950183928, 0.29372105, -0.1269933134, 0.0426195338, -0.0449108183, -0.0112304799, -0.2169743478, 0.2020893842, 0.1722292751, -0.3479177952, -0.2839290202, -0.2502104938, -0.478664428, 0.2983992398, 0.2423683554, 0.6819912791, -0.0241152029, -0.0504564643, 0.0272311177, -0.1523955911, 0.8559724689, -0.5813959241, -0.38344419, 0.313341707, -0.4112906456, -0.2568886578, -0.1569910049, -0.2074816823, 0.5572004318, 0.4230450392, 0.4213477075, -0.1724170744, -0.2897494435, 0.1223191395, -0.2117934078, -0.0765743926, -0.0049094758, -0.3257118464, 0.0413430929, -0.1830746979, 0.0275972672, -0.2412201911, 0.0921081156, -0.1844060123, -0.1235987917, -0.0644756407, -0.0527578555, 0.1900013834, 0.0667349175, -0.0137833022, -0.2407398373, 0.0838182122, 0.0814905763, 0.1122454554, 0.2761133313, 0.2073537707, -0.4210834205, -0.1212017164, 0.1534607857, 0.0207236633, 0.2747566998, 0.24812451, 0.2212693989, -0.0763031319, 0.0679316446, 0.1537783146, -0.3496286273, -0.0344162807, 0.4136732221, -0.0135286776, -0.4599660039, -0.1147128269, -0.0684802085, 0.4527403414, -0.1746955067, 0.5284518003, -0.4588581026, -0.2545072734, 0.3466487527, 0.076022476, 0.7190536261, -0.401617676, -0.0562178753, 0.0151907094, -0.0228416249, 0.0593849272, 0.0745065138, 0.0395904072, -0.2484300733, 0.030645553, -0.0443412662, 0.046340052, 0.3351759613, 0.1809004992, -0.1599562168, 0.392719835, 0.0175098293, -0.1283551604, -0.0871314257, 0.2037594616, 0.4618610144, -0.0916174427, 0.123685807, 0.0090225488, -0.0373495184, -0.141835615, 0.0292477775, 0.0303375702, 0.291194886, -0.1087183207, -0.4325698614, -0.0954677984, -0.1311915964, 0.1541177481, 0.1544956267, 0.1990781575, -0.0326027833, 0.1023310497, -0.1661852747, 0.0416755006, -0.1075471789, -0.1571245492, 0.08113309, 0.3711446226, 0.1824041009, 0.0543468334, 0.3112123609, 0.0866434798, -0.2523911297, 0.038198743, -0.2390211821, -0.2315141559, 0.0284905042, 0.0544314124, 0.0770219564, 0.1647557616, 0.0821130499, -0.0087169623, -0.1461446881, -0.1440384835, 0.0647431985, -0.0179151688, -0.1472049654, 0.4881017506, -0.0362946242, -0.3848836422, 0.0069668437, 0.4981958568, 0.2140212506, -0.0611993335, 0.114950791, 0.1187438369, -0.050651107, -0.2443605065, -0.2095257938, 0.2826493979, -0.1479826719, 0.2815427184, 0.0740330666, -0.2316265702, 0.2187853307, 0.0325040482, 0.063722834, 0.3333227336, -0.2180024534, -0.3376719356, -0.4480594099, 0.3275710344, 0.0213086195, 0.069789432, -0.0914684087, 0.0742155761, -0.0702164695, 0.2902160585, -0.2416670769, 0.1283612996, -0.0914110392, 0.2105483562, -0.0862653106, -0.0200426746, -0.1199354678, -0.0852737501, 0.0836799666, -0.0180117488, -0.2818259299, -0.0459659323, 0.0401628427, 0.1124786362, 0.0590033829, -0.2106229961, -0.0275251251, -0.1331014633, -0.1302313358, -0.2069943398, 0.1849373877, 0.3496141732, -0.2491646111, 0.1554155946, 0.2163188607, 0.1715705544, 0.05576602, 0.3391495645, -0.2267330736, -0.0104442118, -0.0211599879, 0.4098550975, 0.1665138304, -0.1714047045, -0.0185560007, 0.0839515775, -0.0475135744, 0.0274628066, 0.3284186125, -0.1623187065, 0.0814616159, 0.0122953765, 0.4144151807, 0.3997433186, -0.0963427797, 0.0735944957, 0.1048041284, 0.1085937172, 0.0461436808, -0.1891904175, 0.527397573, 0.0765307099, 0.103368029, 0.2709962428, 0.3167988658, -0.1239269525, 0.1547924578, 0.1226015687, -0.1012955457, -0.0107696131, 0.2172140777, 0.1855545938, 0.0957501009, 0.271964252, 0.195319891, -0.3276029527, -0.1445707828, 0.3017551005, -0.0117890611, 0.6197065115, -0.0176015738, 0.1720773876, -0.0681525841, -0.6532103419, 0.113498874, 0.0888801217, -0.5180869699, 0.2230884135, -0.0083674528, 0.2138805091, -0.3701969385, -0.4355388284, -0.1738753319, 0.397020936, -0.3046889603, -0.3131809831, -0.1625991464, -0.1394877285, -0.0880025551, 0.0597068854, -0.1238611564, 0.2549751103, 0.8632916808, 0.061649356, -0.0298707858, -0.1592309326, -0.3787843883, -0.0492620021, 0.3128963113, -0.0241103433, 0.367271632, -0.0567249209, 0.0261305831, -0.0641732886, 0.2130481005, 0.4203890562, 0.7252756357, -0.4599179327, -0.025921626, 0.1545586288, -0.0643241778, -0.1112350076, 0.4476117492, 0.1016501784, 0.2901471555, 0.2144192457, -0.047745306, 0.0076083471, -0.2236594856, 0.2952459157, 0.3430363536, 0.0674071535, 0.3543583751, 0.0387332514, -0.1062363908, 0.2686704695, 0.093920663, -0.2781712413, -0.2895064652, 0.4929397702, -0.4646965563, 0.1978829801, 0.1666083187, 0.0611947253, 0.0654458404, 0.4523872435, 0.2915229201, 0.0668629333, -0.311378032, -0.1597791314, -0.4288888574, 0.0130602801, -0.2220525295, 0.3328107297, 0.0194290467, -0.0061472952, -0.0825501531, 0.0802581087, -0.0234006941, -0.2516876757, 0.3622831404, 0.3247747123, -0.5693953037, 0.2066017389, 0.0963996872, -0.0811116695, 0.0033281362, -0.2955179811, 0.356775701, 0.0581230894, -0.0845475197, 0.059884239, 0.123747088, 0.0907380953, 0.2181306779, -0.0084369313, 0.2849671841, 0.574516654, -0.0258132759, -0.0119336993, -0.226360932, 0.0990830883, -0.0619271062, -0.0422168411, 0.0261934418, 0.4040818512, -0.2270918489, -0.0838276967, -0.0307072233, 0.1885605156, -0.053522367, 0.1660208255, -0.4402961433, 0.1806245446, 0.181824401, 0.0434452146, -0.1316506416, 0.3896892965, 0.1911215931, 0.286524117, -0.2992209792, -0.1361808926, 0.2220961601, -0.0719353259, -0.080338411, -0.6504667401, 0.2088208199, -0.2121038735, 0.1164393798, -0.5232222676, -0.3167286217, 0.1987283826, -0.1904964447, -0.5479641557, 0.2404860109, -0.120756574, -0.1622242779, -0.0673250705, -0.1826598495, 0.1011768207, -0.1056634709, 0.2155494541, -0.0217620693 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
@lhoestq Thanks for taking a look. I pulled the master but I still see the key error. ``` To disable this warning, you can either: - Avoid using `tokenizers` before the fork if possible - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false) #0: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 21.56ba/s] #1: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 17.71ba/s] #2: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 20.45ba/s] #3: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 26.05ba/s] #4: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 26.83ba/s] #5: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 27.00ba/s] #6: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 27.40ba/s] #7: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 25.91ba/s] #8: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 22.46ba/s] #9: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 20.15ba/s] #10: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 26.81ba/s] #11: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 27.45ba/s] 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 322/322 [00:00<00:00, 1462.85ex/s] Traceback (most recent call last): | 0/1 [00:00<?, ?ba/s] File "text2struct/run_model.py", line 372, in <module> main() File "text2struct/run_model.py", line 368, in main | 0/1 [00:00<?, ?ba/s] run_model(auto_envvar_prefix="GFB_CIES") # pragma: no cover File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) | 0/1 [00:00<?, ?ba/s] File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 1236, in invoke return Command.invoke(self, ctx) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "text2struct/run_model.py", line 136, in run_model ctx.invoke(ctx.command.commands[config_dict["mode"]]) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "text2struct/run_model.py", line 187, in train run_train_model(_parse_subcommand(ctx)) File "text2struct/run_model.py", line 241, in run_train_model checkpoint_steps=config.train.checkpoint_steps, File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/train.py", line 153, in alternate_training max_len=config.model.dim.max_len, File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 466, in load_prodigy_tf_datasets folder, file_patterns, vocabulary, cache_dir=cache_dir, test_pct=test_pct File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 447, in load_prodigy_arrow_datasets fn_kwargs=dict(tokenizer=vocabulary.tokenizer, vocabulary=vocabulary), File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1224, in map update_data = does_function_return_dict(test_inputs, test_indices) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1195, in does_function_return_dict function(*fn_args, indices, **fn_kwargs) if with_indices else function(*fn_args, **fn_kwargs) File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 348, in relation_ds_factory ner_labels = example["ner_labels"] KeyError: 'ner_labels' ```
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
299
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` @lhoestq Thanks for taking a look. I pulled the master but I still see the key error. ``` To disable this warning, you can either: - Avoid using `tokenizers` before the fork if possible - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false) #0: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 21.56ba/s] #1: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 17.71ba/s] #2: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 20.45ba/s] #3: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 26.05ba/s] #4: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 26.83ba/s] #5: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 27.00ba/s] #6: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 27.40ba/s] #7: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 25.91ba/s] #8: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 22.46ba/s] #9: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 20.15ba/s] #10: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 26.81ba/s] #11: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 27.45ba/s] 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 322/322 [00:00<00:00, 1462.85ex/s] Traceback (most recent call last): | 0/1 [00:00<?, ?ba/s] File "text2struct/run_model.py", line 372, in <module> main() File "text2struct/run_model.py", line 368, in main | 0/1 [00:00<?, ?ba/s] run_model(auto_envvar_prefix="GFB_CIES") # pragma: no cover File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) | 0/1 [00:00<?, ?ba/s] File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 1236, in invoke return Command.invoke(self, ctx) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "text2struct/run_model.py", line 136, in run_model ctx.invoke(ctx.command.commands[config_dict["mode"]]) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "text2struct/run_model.py", line 187, in train run_train_model(_parse_subcommand(ctx)) File "text2struct/run_model.py", line 241, in run_train_model checkpoint_steps=config.train.checkpoint_steps, File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/train.py", line 153, in alternate_training max_len=config.model.dim.max_len, File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 466, in load_prodigy_tf_datasets folder, file_patterns, vocabulary, cache_dir=cache_dir, test_pct=test_pct File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 447, in load_prodigy_arrow_datasets fn_kwargs=dict(tokenizer=vocabulary.tokenizer, vocabulary=vocabulary), File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1224, in map update_data = does_function_return_dict(test_inputs, test_indices) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1195, in does_function_return_dict function(*fn_args, indices, **fn_kwargs) if with_indices else function(*fn_args, **fn_kwargs) File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 348, in relation_ds_factory ner_labels = example["ner_labels"] KeyError: 'ner_labels' ```
[ -0.4438699186, -0.1675046384, -0.0400715694, 0.1716091335, 0.0889460295, -0.1188245937, 0.2078460604, 0.3421574533, 0.1180476174, 0.1576037854, 0.1306533813, 0.4856556952, -0.4362101555, 0.2786430717, -0.3663626611, 0.095104754, 0.111420542, -0.0841654465, -0.2514489889, 0.2458093613, -0.2524545193, 0.293427825, -0.2909145951, 0.1944313347, -0.5435570478, 0.0569211878, -0.0106123341, 0.316097647, 0.0055234353, -0.6119190454, 0.2811326981, 0.3099721074, -0.0368734784, 0.3930646777, -0.0001247698, 0.1380000114, 0.3410487175, -0.0913273618, -0.0481132194, -0.3334735632, -0.1873981506, -0.2403928041, 0.2672141194, 0.0872505382, 0.1997457892, -0.0002407176, -0.0975957885, -0.2515732348, 0.258379966, 0.3503321409, 0.083493337, 0.2617159188, 0.2949204445, 0.1206843778, -0.0550054163, 0.1494258195, -0.0134721482, 0.0250231028, 0.3076895177, -0.3135741055, -0.1309463233, 0.2591975331, -0.2412052453, -0.2611985505, -0.1408822536, -0.2327822149, 0.6852397919, -0.6341822743, 0.2206972837, 0.0248724744, -0.2827393115, -0.0443476178, -0.4056612253, -0.2426632494, -0.2770730555, -0.4417162538, 0.2661076188, -0.0212124586, -0.2025266886, 0.1933267862, -0.4429095089, -0.2660004795, 0.024545446, -0.1426336169, -0.0494138263, 0.5700024366, 0.2672021985, 0.2987837493, 0.2195274979, 0.1560346782, 0.1490323544, -0.0205229819, -0.1217984855, 0.1732534617, -0.421153605, 0.0671506822, 0.0852115154, -0.1910000443, -0.2070726752, 0.0080279913, -0.2620820403, 0.0897587836, -0.1146722361, 0.0613034964, 0.3845330775, -0.1019944698, 0.18102552, 0.3499879241, 0.2183628827, -0.2259045243, 0.0349914767, 0.0682252422, 0.2776801586, -0.0831104741, -0.0578657985, 0.3552603424, 0.1289922893, -0.1625505537, -0.1366446465, 0.1850895435, -0.0507496297, -0.1519200802, 0.0860179588, 0.2178293765, 0.0702170506, 0.7802467942, 0.1076597869, 0.1804843247, -0.3048226535, -0.0502080619, -0.0702662542, -0.0836347267, -0.3501508832, 0.0839560926, 0.2303638011, 0.0645156726, 0.0073768026, 0.0501156189, -0.3548416495, -0.2700490654, 0.0857494473, -0.2150369883, 0.0925927162, 0.724262476, -0.104412362, 0.071030356, -0.0193018373, -0.1493758261, 0.0569707528, 0.305591166, -0.5235203505, -0.2392238975, -0.1953843385, 0.0776033849, -0.0194744356, 0.2954955995, -0.1016280279, 0.2702437639, 0.4557404518, -0.3296605051, -0.2684331834, -0.320864588, -0.365288198, -0.3097073436, 0.0002421751, 0.2654046118, -0.4719288945, -0.0701093525, 0.0881142914, -0.2383557111, 0.320779115, 0.2269820869, -0.0228192862, -0.0254131891, -0.1377122551, 0.1407949477, 0.0430819243, -0.210570246, -0.1295746267, 0.2465182543, -0.02176941, 0.3109730482, -0.0010191924, -0.2680619359, 0.3701477349, -0.1722934842, 0.2614528835, -0.1228103787, -0.159778893, 0.0373745337, -0.4497857392, -0.0502867922, -0.0986655131, -0.1323398203, 0.4002125561, 0.1608782858, -0.1596159339, -0.483943969, 0.3021203279, -0.0692917258, 0.3450359702, 0.0765080452, 0.1038473472, 0.0943719894, 0.1545056552, -0.1950789988, -0.4406285584, 0.2530567646, -0.2359962016, 0.0414475948, -0.0916197896, -0.0021405129, 0.0889062062, 0.2467319071, -0.2203757167, -0.1574907899, 0.0297026969, -0.0926259309, -0.2858549654, 0.0036855584, -0.1975903958, 0.5724756122, 0.0759175345, 0.1623218358, -0.059548758, 0.1222858876, -0.2260801643, -0.3706210852, -0.2846195102, 0.2243588716, 0.0114291925, -0.0456315763, -0.1860871315, 0.4331724942, 0.4528886974, -0.0840673596, -0.0524536856, 0.1870766282, 0.2882179916, -0.2102930248, -0.1363983899, 0.0566668622, -0.000644455, -0.2004670799, 0.2589431405, 0.4819488227, 0.1949970126, 0.4277968407, 0.1515736282, 0.2473339289, 0.3132831752, 0.0197372399, -0.0024226492, -0.1308802813, 0.1747963578, -0.1996352524, 0.1646609753, -0.0104094585, -0.0819551423, -0.1719730049, 0.0619493648, 0.0059800944, -0.1777108908, 0.069023177, 0.1067488492, -0.1143576726, 0.1525012404, 0.0578256734, 0.3588521183, 0.0116988979, -0.1743932813, 0.1712273508, -0.2872718871, -0.0165321101, 0.1565525532, -0.0600654744, 0.3869135082, 0.3310391605, 0.0293595195, -0.0537553914, -0.1345197111, -0.286023587, 0.1273596138, 0.3807801306, -0.4825976193, 0.2592693865, -0.2457226664, 0.385127604, 0.1693532467, -0.1360457093, -0.2819574475, -0.6221181154, -0.0652161166, 0.4566326141, -0.1154796183, 0.1542273313, -0.0666651726, 0.0565893725, -0.2285955101, 0.3749102354, -0.2166072428, -0.3992303312, -0.1672301143, -0.1114406586, 0.3502188623, -0.3183426261, 0.20551157, 0.1797626317, -0.2845514715, 0.1939576417, -0.3226080835, 0.1029554233, -0.1233834773, 0.0229364485, 0.1417060494, -0.0295712687, 0.0921473429, -0.2455622852, 0.1196155995, -0.2157845646, -0.270142138, 0.2534023225, -0.1736675203, 0.0497095846, -0.2838626802, -0.2666268349, -0.4348909557, -0.103808552, -0.0615855381, -0.2117896527, 0.3445334136, 0.150599122, 0.0339489318, -0.0018496979, -0.0442046449, 0.0065712896, -0.0929127634, -0.0397026949, -0.2193153054, 0.0723465458, -0.0794134885, 0.0087243877, 0.040815331, 0.178684786, 0.2683212161, -0.315530479, 0.1561603248, 0.0617139637, -0.0350544006, 0.1973544955, -0.2283175141, 0.2923779786, 0.4386341274, 0.0282353722, -0.0359947011, -0.116021283, 0.1322574019, -0.058226157, 0.0320600159, 0.0781753957, 0.3204673529, 0.185185343, 0.6763287187, 0.3327035904, 0.0967168659, 0.3227103949, -0.0756794587, 0.0984893367, -0.1708205491, -0.3568718731, -0.2422765493, -0.2925570905, -0.0492549166, -0.2442120165, -0.1278546005, -0.4333048761, -0.2589369714, 0.557059288, -0.364151001, -0.2965090573, -0.0185922943, -0.5365775228, 0.2150663882, -0.0889229029, 0.0328724049, -0.0712171718, 0.0218732357, -0.2308910042, 0.2551977932, 0.1453685015, -0.3435901403, -0.347494781, -0.2690311074, -0.5460584164, 0.2908352017, 0.1735796928, 0.6667122841, 0.0073580933, -0.0688792393, 0.0245229695, -0.1858623028, 0.934643209, -0.5217698812, -0.3587030768, 0.3193503022, -0.3986980021, -0.2629765272, -0.1964328587, -0.1744772494, 0.5878406167, 0.4124093056, 0.4205792844, -0.1871403903, -0.3219944835, 0.1479856819, -0.2433123887, -0.1495635659, -0.0031312595, -0.3532734811, 0.001774338, -0.2907101214, 0.1065585613, -0.1895603985, 0.1086731777, -0.3118034303, -0.044196099, -0.0536379516, -0.1121005192, 0.190681994, 0.0595514998, -0.0004535394, -0.2153483927, 0.0571137182, 0.0515729673, 0.0525746793, 0.2204808742, 0.2181242406, -0.2953675985, -0.0804440156, 0.16284284, 0.0561926775, 0.255577445, 0.2743009329, 0.2173483074, -0.0336351432, 0.1120121703, 0.1660033464, -0.338603884, 0.0078565022, 0.2948585153, -0.0222804341, -0.5951178074, -0.116429925, -0.0660492703, 0.4181352854, -0.2006957382, 0.4809942245, -0.3640758693, -0.2475473583, 0.4040856361, 0.1156169474, 0.8487921953, -0.4349768758, -0.0354044996, 0.0730251223, 0.0347611196, 0.0952217877, -0.0260101929, -0.0044386331, -0.321298182, 0.0248712767, -0.0477382988, 0.0450861081, 0.2680167854, 0.1381972134, -0.1732301563, 0.3865533769, -0.0107104089, -0.1017478853, -0.0425721891, 0.1595098227, 0.4235086739, -0.0358468816, 0.2206966728, -0.013976681, 0.00378342, -0.1126477197, 0.0064296573, 0.0148409307, 0.2116280198, -0.1840919107, -0.481127888, -0.1047284454, -0.0924684331, 0.1672159135, 0.1426284015, 0.131579563, -0.0313531645, 0.0471194349, -0.0821706429, 0.1316121817, -0.0795810148, -0.1066342965, 0.0960281491, 0.3185381293, 0.1848516911, 0.0571673252, 0.2695897818, 0.0950200409, -0.2720302939, 0.0871153325, -0.276904285, -0.2623151243, 0.0128055867, 0.0352958031, 0.0424246863, 0.1547396481, 0.0866839588, 0.0098206513, -0.1576528549, -0.2034298182, 0.0333737619, -0.0181388743, -0.1581918746, 0.4551257193, -0.0940321758, -0.3601727486, 0.0371086523, 0.4425573945, 0.2474647164, -0.0432841703, 0.1479089707, 0.1199448928, -0.0285278186, -0.2268240899, -0.2088472992, 0.2126791179, -0.2034066021, 0.2764653862, 0.074224636, -0.3003954589, 0.1926260442, 0.0381829478, 0.1105419025, 0.3506318033, -0.2179450542, -0.3140776157, -0.5096752048, 0.2873862386, -0.0424414873, 0.1220763624, -0.0970073268, 0.1696492732, -0.1525715292, 0.3414256573, -0.2173338532, 0.1055868939, -0.162912026, 0.1904527098, -0.1025945991, -0.0219333153, -0.1139365509, -0.1034620777, 0.0645447522, 0.0122853965, -0.2283413261, -0.0161116514, 0.034734387, 0.1336134225, 0.0958128497, -0.1613650322, -0.0570762381, -0.0350734927, -0.095262453, -0.1288368106, 0.1950084269, 0.3021522164, -0.184054628, 0.2073192447, 0.2600148022, 0.2184172869, 0.0725980252, 0.3586005867, -0.1578324437, 0.0714998543, 0.0375998914, 0.4504763186, 0.1239430085, -0.1813463569, -0.0115453759, 0.1517645717, -0.0749083385, 0.0154510159, 0.3202468455, -0.1412190497, 0.0418410711, -0.0255631469, 0.3905258179, 0.40804708, -0.1006333902, 0.0914166495, 0.1294076145, 0.0766719058, 0.0393772982, -0.235676378, 0.5182751417, 0.0912389159, 0.0712265298, 0.327470839, 0.343883872, -0.148200646, 0.219012931, 0.1972624511, -0.0391974896, -0.006076334, 0.2387898862, 0.2392290533, 0.0759490803, 0.2791832387, 0.2188095301, -0.3160719573, -0.0826136097, 0.3064985573, -0.0430861749, 0.5566523671, -0.0231059231, 0.1107525378, -0.0504672937, -0.6661482453, 0.0684486404, 0.0505355224, -0.4930523336, 0.2006001025, 0.0285407621, 0.2260497808, -0.284384042, -0.4488838315, -0.1733899564, 0.4938542247, -0.3161691725, -0.3530266583, -0.2420186549, -0.1568670869, -0.079410933, 0.0364156626, -0.0944969356, 0.2113802582, 0.7398546934, 0.0275039747, -0.0592762604, -0.1394858807, -0.3253464699, 0.0243773088, 0.3143859506, -0.0302810594, 0.3852972984, 0.0602537952, 0.0233476683, -0.0070995423, 0.1115662083, 0.5153452158, 0.6486161351, -0.4715347588, -0.0051936423, 0.1361395568, -0.067125015, -0.1269529611, 0.4410918057, 0.093670316, 0.2746120393, 0.2441115379, -0.0740943179, 0.0241559539, -0.2729541063, 0.3861775994, 0.3558558524, 0.1640089452, 0.3792752922, 0.089874953, -0.1598762423, 0.2703372836, 0.156139046, -0.2949357927, -0.2356022894, 0.4741259813, -0.4620780349, 0.230651781, 0.189804852, 0.0532197841, 0.0667015612, 0.5093151927, 0.3080868423, 0.0298368633, -0.3025137484, -0.1432610005, -0.420933634, 0.0029770983, -0.1952993423, 0.2641442716, 0.0434207134, 0.015194959, -0.0301828459, 0.1026465595, -0.0260660294, -0.2269302607, 0.338041842, 0.3651677072, -0.490059644, 0.2121445984, 0.1048491225, -0.073070541, -0.0113662062, -0.2620002031, 0.3681489825, 0.0782690495, -0.0984347984, 0.1029913202, 0.1684939861, 0.0956899375, 0.1215945333, 0.0248366464, 0.3121724427, 0.5543994308, -0.0393268391, -0.0194798522, -0.2440264672, 0.0761286691, -0.1203723401, -0.0872048289, 0.0565832481, 0.379470408, -0.1878676265, -0.0857280791, -0.0020314008, 0.1167895943, 0.0629816502, 0.1787514687, -0.4754637778, 0.2667179108, 0.1632101536, 0.0898108408, -0.1624223739, 0.4008591175, 0.2307241261, 0.3632059693, -0.3065880239, -0.2034913301, 0.3098654151, 0.0045147021, -0.0913124681, -0.5519124866, 0.1878932863, -0.1802451015, 0.1410411298, -0.5005386472, -0.3521082401, 0.1755146086, -0.2155506462, -0.5762810111, 0.2504350841, -0.0661979318, -0.2007855624, -0.0668061301, -0.1931966841, 0.1094471291, -0.1223391593, 0.2190398127, -0.0942721441 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
The parallelism is automatically disabled on `tokenizers` when the process gets forked, while we already used the parallelism capabilities of a tokenizer. We have to do it in order to avoid having the process hang, because we cannot safely fork a multithreaded process (cf https://github.com/huggingface/tokenizers/issues/187). So if possible, the tokenizers shouldn't be used before the fork, so that each process can then make use of the parallelism. Otherwise using `TOKENIZERS_PARALLELISM=false` is the way to go.
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
75
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` The parallelism is automatically disabled on `tokenizers` when the process gets forked, while we already used the parallelism capabilities of a tokenizer. We have to do it in order to avoid having the process hang, because we cannot safely fork a multithreaded process (cf https://github.com/huggingface/tokenizers/issues/187). So if possible, the tokenizers shouldn't be used before the fork, so that each process can then make use of the parallelism. Otherwise using `TOKENIZERS_PARALLELISM=false` is the way to go.
[ -0.4698335826, -0.1674959064, -0.0140369888, 0.1800089478, 0.0854438543, -0.190538466, 0.2459652424, 0.275629282, 0.1016366705, 0.1726740748, 0.0916072503, 0.4495116472, -0.3661405444, 0.2278047055, -0.3540112972, 0.0023671486, 0.1458532661, -0.1064162031, -0.1076291054, 0.2664555013, -0.1931275278, 0.3243031502, -0.2955477238, 0.1895089149, -0.5507260561, 0.0559618361, -0.0354775712, 0.2832091749, -0.0593082868, -0.6136327386, 0.2357298285, 0.3920497596, 0.0007348989, 0.4456870556, -0.0001240691, 0.1468002796, 0.3075380027, -0.0330978781, 0.0126843676, -0.3793183863, 0.0019110995, -0.3051971197, 0.2444292754, 0.1721024364, 0.2013462186, -0.1140400246, -0.1220815107, -0.1859960109, 0.3015089333, 0.2977146506, 0.0780778304, 0.3740779757, 0.2976615131, 0.1366762966, -0.1064470112, 0.1475404054, -0.047567606, 0.0469948389, 0.3224132955, -0.2692291141, -0.1280241162, 0.2051905096, -0.2646254301, -0.2231664658, -0.1501528472, -0.2274799198, 0.5331186652, -0.5728855729, 0.2040057629, 0.0972767696, -0.27528283, -0.0516941212, -0.4340721667, -0.2814347148, -0.3205261827, -0.5091424584, 0.2326752096, -0.0793349892, -0.1704740673, 0.1779232621, -0.4278573394, -0.2340728045, 0.0443509333, -0.1019556448, -0.1272600889, 0.5708982348, 0.1884502321, 0.3039302528, 0.1742692888, 0.1578973234, 0.0501510724, -0.0234682597, -0.1019762233, 0.1722771674, -0.4143753648, 0.046293471, 0.1032641456, -0.3558399975, -0.1825720072, 0.121704258, -0.2746937573, 0.1585308164, -0.1526546627, 0.0980686545, 0.3795082867, -0.0054285135, 0.1715633422, 0.2787450254, 0.246555835, -0.2089061439, 0.0966485217, 0.0370958485, 0.2416518182, -0.0345837511, -0.1681513786, 0.2515702844, 0.1012416556, -0.1497586071, -0.1228373721, 0.1711273491, -0.0874945149, -0.131754756, 0.1335783303, 0.2265294194, 0.0358567834, 0.7409482598, 0.095984228, 0.1662243456, -0.3377200365, -0.0669961795, -0.070126839, -0.0903124958, -0.3008594215, 0.12500076, 0.1836821586, 0.1333361566, 0.011081703, 0.0407856964, -0.3716785908, -0.2365082353, 0.1697463393, -0.2469154149, 0.0945086032, 0.6521362066, -0.0997273624, 0.0555376634, -0.0186683368, -0.0468875058, 0.0317684524, 0.1966138929, -0.4765745401, -0.1805384606, -0.243328467, 0.0614766665, -0.0035068044, 0.2686829865, -0.2681765556, 0.3582109213, 0.3775330782, -0.339284271, -0.2765752673, -0.3204177916, -0.3733096421, -0.2689912617, 0.0655428022, 0.2235532701, -0.3428302109, -0.1210212409, 0.1379305571, -0.2942819297, 0.3426653445, 0.3083378673, -0.0074370643, 0.0716674179, -0.1562376618, 0.2892133296, 0.0653890297, -0.215859279, -0.0655001849, 0.1830653548, -0.0553091876, 0.3571150601, -0.0528864078, -0.2939491868, 0.4720182419, -0.0873195753, 0.2116507292, -0.0297005884, -0.1419223249, 0.0854480192, -0.4349108338, -0.0488807783, -0.0801713467, -0.1022237763, 0.3707357943, 0.1900942624, -0.1735138893, -0.4965017438, 0.2677111924, -0.1114350334, 0.3222939968, 0.0715092495, 0.1434360445, 0.2017227858, 0.1305197626, -0.2422706336, -0.3775041401, 0.2210633755, -0.2406437397, 0.0430390015, -0.0146288387, -0.07652428, 0.1771068424, 0.196038276, -0.2122108638, -0.1775560826, 0.0294700544, -0.0402089581, -0.2606338263, -0.0142162489, -0.2204613835, 0.5387181044, 0.0587078258, 0.2526373863, -0.0555027239, 0.1792501211, -0.1390036345, -0.4171823561, -0.3341960609, 0.244484067, 0.0404216312, -0.1081419066, -0.1812632829, 0.4281125665, 0.4532394409, -0.0259471741, -0.0781765282, 0.1995646358, 0.3030531406, -0.1107942313, -0.1663928479, 0.0268021431, -0.0005160873, -0.1456861198, 0.325219512, 0.4752385318, 0.2583376765, 0.3575921655, 0.2223505825, 0.1967344582, 0.3676941097, 0.0150890872, 0.0022732615, -0.0769254714, 0.2094925493, -0.0871467814, 0.1809678972, -0.0041484139, -0.1150161102, -0.1338174343, 0.0661971122, 0.0200307127, -0.1528683901, 0.0386653394, 0.0771415606, -0.1419483125, 0.195778802, -0.0908225179, 0.324619472, 0.0216592159, -0.1594499201, 0.1472175121, -0.2333882451, 0.0095727732, 0.0928069279, 0.0083767502, 0.2946353555, 0.3339906633, 0.0658817142, 0.0199003965, -0.2926730514, -0.3580293655, 0.1330217421, 0.3469077647, -0.4571527541, 0.2395320386, -0.233221516, 0.4305514693, 0.1446417719, -0.1823007762, -0.3057282269, -0.5543477535, -0.0787179098, 0.6065194607, -0.13800475, 0.1733262688, 0.0008417621, 0.2153343409, -0.2424017638, 0.4286288023, -0.2241808623, -0.3289695382, -0.2124573439, -0.132561788, 0.3449447751, -0.2445284277, 0.2342279255, 0.1797368973, -0.3173708618, 0.0695010871, -0.4021348059, 0.1804141998, -0.0857737362, 0.0844074115, 0.1158487275, -0.0306752436, 0.0407303832, -0.2014771402, 0.1514792144, -0.2354545593, -0.2923106849, 0.2084234357, -0.1431323588, -0.0121391099, -0.2302772254, -0.2263070941, -0.4417108595, -0.1428990215, 0.0151709672, -0.262347281, 0.2979032695, 0.0964590609, -0.0297174305, 0.0305126868, -0.1678614318, 0.069615148, -0.1205817014, -0.0331986174, -0.2646495998, 0.0089350343, -0.1214704663, -0.0549473986, 0.050469324, 0.1772570461, 0.3300921917, -0.2351269275, 0.0866731182, 0.0608826391, -0.0232306309, 0.1820591092, -0.2267751992, 0.3626006246, 0.3413054943, 0.0460004918, 0.007707681, -0.154269293, 0.096947737, -0.1244620308, 0.0159215499, 0.1115940511, 0.4085760415, 0.2045240849, 0.7586420178, 0.3068211973, 0.0815785006, 0.4106377363, -0.114926137, 0.1306594014, -0.1736630052, -0.4086286426, -0.1645550132, -0.278865844, -0.0181172118, -0.1671079695, -0.1037885994, -0.3872557282, -0.2170630246, 0.4757825136, -0.3586521447, -0.2796052992, -0.0407272317, -0.3742519021, 0.2615021467, -0.08087001, 0.0854490846, -0.1107372791, 0.0205805823, -0.1939820051, 0.3396611512, 0.1362639964, -0.2989440262, -0.456395179, -0.1417518705, -0.5637003779, 0.2795662284, 0.1750623882, 0.7341637015, -0.0234585144, -0.0551584847, 0.0587684065, -0.1976897866, 0.9357399344, -0.359424144, -0.4217446744, 0.2894861698, -0.5509145856, -0.239615351, -0.1999230087, -0.1644482911, 0.5423983932, 0.5066508651, 0.454192847, -0.2640608847, -0.37562415, 0.1025580913, -0.2309691012, -0.1180361211, -0.0011557572, -0.3292896152, 0.0030470942, -0.306846261, 0.1469483227, -0.2366101146, 0.1321084201, -0.2422953248, -0.1088755503, -0.1110605001, -0.1524033546, 0.1520628482, 0.0903228745, -0.0314772204, -0.278401792, 0.0413448364, 0.1173493266, 0.0203277562, 0.2515929639, 0.1480955482, -0.1945678443, -0.2651031911, 0.1867990792, 0.1416078955, 0.2887450755, 0.299869746, 0.170991689, 0.0748203695, 0.1025458798, 0.2095711529, -0.3290911019, 0.1400386989, 0.3358182907, 0.0699672997, -0.5486971736, -0.0179220922, -0.0950680152, 0.4445161223, -0.1411135197, 0.5347311497, -0.3712588549, -0.2485486269, 0.3692538142, 0.0327238515, 0.8252356052, -0.3295947015, -0.0434361435, 0.1655750126, 0.016216686, 0.149518922, -0.1232441142, 0.0196427274, -0.3308780193, 0.105877094, -0.0595266558, 0.0748169199, 0.363846004, 0.101183258, -0.0730093867, 0.3764548898, 0.0869760364, 0.0188116636, -0.0523898602, 0.2291524857, 0.3855037093, -0.1186163276, 0.123710148, -0.0242683906, -0.0108194416, -0.0757307485, -0.0079826359, 0.0491068922, 0.2691781521, -0.1717044413, -0.4417434633, -0.157189846, -0.1704282463, 0.1635922194, 0.2262084931, 0.1969401091, -0.0660276115, -0.1102874801, -0.0307530463, 0.1097052321, -0.0953581408, -0.1034524441, 0.0131335696, 0.2929882407, 0.1415535063, -0.0207575411, 0.3205951154, 0.0703556985, -0.1965800226, 0.0415911935, -0.2161636353, -0.2890791595, 0.0082083018, 0.0118190264, 0.1558249891, 0.1179112345, 0.1515678614, 0.0131440936, -0.0991613194, -0.2529162467, 0.0169842634, 0.0426876768, -0.2005050182, 0.3394846618, -0.086979717, -0.300457567, -0.0263285059, 0.4269419611, 0.1343546063, -0.1657797396, 0.0890288651, 0.14596048, -0.0572542809, -0.1820950955, -0.2436643392, 0.3081690967, -0.1138095409, 0.2650248408, 0.0591091663, -0.3618755937, 0.151651457, 0.1528609395, 0.0431240872, 0.2574945986, -0.2684717774, -0.3503495157, -0.489890337, 0.291182816, -0.0430529267, 0.1423332095, 0.0262091886, 0.2362663895, -0.2149012089, 0.318253547, -0.2029466778, 0.0799203292, -0.1292324811, 0.1701391041, -0.1570796967, -0.1027875915, -0.1325782984, -0.0717890263, 0.040204946, -0.008499884, -0.2677112818, -0.0053714006, -0.0168906767, 0.1345700324, 0.1642262489, -0.2353509068, 0.0058797644, 0.0347651467, -0.1145364493, -0.2087297142, 0.227535665, 0.2921719253, -0.2415676117, 0.0413199663, 0.2643430829, 0.1993068904, 0.0712750107, 0.3201948702, -0.0814486369, -0.0106403511, 0.0728166178, 0.4271275103, 0.0593407936, -0.1600849628, 0.0053648707, 0.1601386666, 0.1081879884, -0.0624857359, 0.2911907136, -0.1417415738, -0.0191015322, -0.0337679796, 0.3789580464, 0.4425646067, -0.0806520656, 0.000176034, 0.1910728961, 0.0638120845, 0.0837067515, -0.2308318466, 0.6156702638, 0.0289502926, 0.1046120971, 0.2869159877, 0.3824902177, -0.086999163, 0.1666944921, 0.16133295, 0.0975129753, -0.0389079712, 0.2546487749, -0.0366279893, -0.0137626454, 0.3162633479, 0.2590506077, -0.3143553138, -0.1352951229, 0.2599980533, -0.0384013578, 0.5948084593, -0.0969622359, 0.2248374522, -0.0666981712, -0.6823629141, 0.0057193707, 0.0434204228, -0.4615482092, 0.2214366347, -0.0417675786, 0.239071399, -0.3056814373, -0.4851906002, -0.1789883077, 0.587090075, -0.3731826246, -0.362303108, -0.2752658427, -0.1022214592, -0.0483384021, 0.0446071178, -0.0661511868, 0.2078545839, 0.6278227568, -0.0410971567, -0.0900358483, -0.2425192744, -0.3348081708, -0.0144507727, 0.2810930014, -0.0061648092, 0.4593025744, -0.063473098, 0.0371081419, -0.0783298835, 0.2297442108, 0.4838189185, 0.6397122145, -0.3236338794, -0.1313554049, -0.001571959, -0.011216444, -0.1275708228, 0.5054548979, 0.0100007541, 0.231181398, 0.1936003417, -0.0822728425, 0.0042334315, -0.3318100274, 0.3296575546, 0.2684663534, 0.0815627649, 0.3986716866, 0.0138111645, -0.0815165862, 0.212376073, 0.0896239355, -0.2625280917, -0.1877289265, 0.4311323464, -0.4376077056, 0.1901279986, 0.1663138419, 0.0485992357, 0.1046996936, 0.3792056739, 0.3668214381, 0.0105576618, -0.2663842142, -0.1219749823, -0.4246731997, 0.0550434217, -0.1286810935, 0.3264997602, 0.0281256009, -0.0015223228, -0.0064915777, 0.1175888404, -0.1066414565, -0.1334382296, 0.3874144554, 0.2544839382, -0.5440002084, 0.3324021697, 0.0594329163, -0.0865356028, 0.003016657, -0.244536534, 0.4164735377, 0.0530779548, -0.1391579211, 0.1390386522, 0.1647677869, 0.0155449566, -0.0387471505, 0.0465330034, 0.331342876, 0.5452201366, -0.0247945078, 0.0179173835, -0.2891092002, 0.0822055936, -0.1622480452, -0.0324378498, 0.0186814703, 0.427777499, -0.1754865944, -0.0600115769, -0.0635535941, 0.1609641612, 0.0716932341, 0.0929157063, -0.4696354866, 0.3175766468, 0.1130195484, 0.0851165652, -0.1704147607, 0.4451140463, 0.2408339083, 0.3864465058, -0.3660423458, -0.2012935281, 0.3071759939, -0.1852543801, -0.0721667036, -0.6507635117, 0.1840496659, 0.0079313098, 0.0638973862, -0.4796608686, -0.3711153865, 0.1487096101, -0.2079417855, -0.5344145894, 0.2810972631, -0.1004109159, -0.2441051155, -0.087949872, -0.1413972825, 0.1348968446, -0.0782703534, 0.2719238102, -0.0260522645 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
> Thanks for taking a look. I pulled the master but I still see the key error. I am no longer able to get the error since #659 was merged. Not sure why you still have it @timothyjlaurent Maybe it is a cache issue ? Could you try to use `load_from_cache_file=False` in your `.map()` calls ?
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
56
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` > Thanks for taking a look. I pulled the master but I still see the key error. I am no longer able to get the error since #659 was merged. Not sure why you still have it @timothyjlaurent Maybe it is a cache issue ? Could you try to use `load_from_cache_file=False` in your `.map()` calls ?
[ -0.4314344227, -0.1244709268, -0.0213453379, 0.2268492579, 0.1299644858, -0.1009751186, 0.2160617113, 0.4109106362, 0.0611688308, 0.1098550633, 0.0194629412, 0.4327994883, -0.3604688048, 0.3772414327, -0.33953017, 0.0885623395, 0.0790839121, -0.0142770419, -0.3960182667, 0.2743344307, -0.3150268495, 0.2834355235, -0.2949823439, 0.1656473428, -0.5235919952, 0.093062669, -0.1302801818, 0.3110471368, -0.0348665379, -0.580286026, 0.300784111, 0.2864483595, -0.0216589179, 0.4401555955, -0.0001220014, 0.0999584869, 0.3847603798, -0.0793479234, -0.0716061145, -0.3503721654, -0.2476751357, -0.2170802951, 0.2827698886, 0.1046238169, 0.2202925384, 0.0048059807, -0.1133262441, -0.1922503859, 0.2761890888, 0.3521156311, 0.1191014722, 0.1872768551, 0.3880856931, 0.0826241598, -0.0354127288, 0.093760632, 0.0023207241, 0.0315021016, 0.318766892, -0.425323993, -0.0663858056, 0.3480860889, -0.2237597555, -0.2809122503, -0.042226173, -0.256703794, 0.6990743279, -0.604411602, 0.2159710526, 0.0483470596, -0.2460377365, 0.0421749651, -0.4069693089, -0.2098710686, -0.2622977495, -0.4920373261, 0.2894100547, -0.0301970132, -0.2084703296, 0.1472867876, -0.4892233014, -0.3158853948, 0.0184608269, -0.1103787795, -0.0474433899, 0.5334963799, 0.243792221, 0.2392063141, 0.2650358677, 0.0902936161, 0.1246623844, -0.0066081784, -0.1508880556, 0.1766753495, -0.4339984655, 0.0645188168, 0.1089491025, -0.041344516, -0.2220736146, -0.0226173252, -0.2547249794, 0.1037640423, -0.0433887616, -0.0031188342, 0.4134054184, -0.0021766133, 0.2312472165, 0.2805155218, 0.2089719325, -0.1722471416, -0.0612266809, 0.0473837629, 0.3236122429, -0.1497554183, -0.0274686161, 0.3400017917, 0.1807362735, -0.2046604455, -0.0820391923, 0.1177491769, -0.0378102772, -0.1827217191, 0.0796589702, 0.20120655, 0.0385181457, 0.7639834881, 0.1573568583, 0.2139507532, -0.2573186457, -0.0196507573, -0.0640080571, -0.0725232437, -0.3861179948, 0.0672839507, 0.2665234804, -0.144018963, 0.0057662684, 0.0307270233, -0.296227634, -0.273213923, 0.0389926806, -0.2264911532, 0.1082786694, 0.6682197452, -0.0568308011, -0.0038678797, -0.0184365977, -0.1838995218, 0.1021293178, 0.2575797737, -0.5337061882, -0.2903418839, -0.1411549747, 0.1126203984, 0.0741789564, 0.3089140952, -0.1461553425, 0.2622055709, 0.4196608663, -0.3520432413, -0.3468496799, -0.2722083628, -0.3974719048, -0.3425091207, -0.0154754333, 0.2808102369, -0.4167695642, -0.0224716384, 0.0201118682, -0.1394567937, 0.2266026139, 0.1803772449, -0.0676963106, -0.0393481888, -0.1244898587, 0.0694301203, 0.0809169188, -0.2601243556, -0.2011918575, 0.28474617, 0.0258584376, 0.2704035938, -0.0125877075, -0.2769047916, 0.3264493048, -0.2117158622, 0.2866228223, -0.0977260694, -0.1917822808, 0.046807915, -0.4094305336, -0.0715953708, -0.0588158481, -0.1225050092, 0.4039652646, 0.1986884773, -0.1238548234, -0.5356960297, 0.2904839814, -0.0942864269, 0.3269189, 0.1106512547, 0.0971122608, 0.0743153915, 0.1996760368, -0.2014027536, -0.4499592185, 0.2379931957, -0.2776957154, 0.0345755629, -0.0698412657, 0.0290763192, 0.037773747, 0.1411240101, -0.2355709374, -0.1979332715, 0.0776838437, -0.1049175113, -0.24676992, -0.0876591131, -0.2032498568, 0.6826042533, 0.1674461216, 0.1178387254, -0.0962091163, 0.1435921937, -0.2462815344, -0.3751716316, -0.2172574848, 0.2264217436, 0.0565495081, -0.0111120939, -0.2679614127, 0.4512027204, 0.31545344, -0.0701541379, -0.0241985079, 0.1356794983, 0.2313726246, -0.2101557702, -0.1253691763, 0.0301833916, 0.0150993485, -0.213948831, 0.216491729, 0.4391390085, 0.0700735673, 0.4827991724, 0.1989908963, 0.2445266843, 0.2599722743, 0.0034954187, -0.0056858137, -0.1511240304, 0.2132591605, -0.234946698, 0.1760885864, 0.0235666931, -0.0262156501, -0.1778628081, 0.1258430481, 0.0529483035, -0.1465937644, 0.0932000801, 0.0199284479, -0.1221553087, 0.0554959886, 0.084888339, 0.453897953, 0.001958848, -0.1927703768, 0.2290839851, -0.2108614296, 0.0234586429, 0.2167143077, -0.0559658147, 0.3995962441, 0.3053629994, 0.0496961884, -0.0101164635, -0.1340928525, -0.1709621549, 0.0689920634, 0.3572277427, -0.4408538342, 0.1790746152, -0.2723535597, 0.278852582, 0.12702021, -0.1176956967, -0.3178195655, -0.5795161724, -0.0903855041, 0.4781472385, -0.0622867569, 0.1386608481, -0.0254732948, 0.0500340797, -0.1990745813, 0.3770761788, -0.2009774446, -0.4059011936, -0.1911113858, -0.0859190822, 0.3534832299, -0.3365893662, 0.2275674939, 0.1413680613, -0.2084483802, 0.198938325, -0.3869026601, 0.0617680028, -0.1056495532, 0.037792407, 0.1049740911, 0.0098566227, 0.0452487394, -0.2347851843, 0.170617193, -0.2592054904, -0.2953840196, 0.2534520924, -0.1604864001, 0.117503278, -0.2453967482, -0.3316819668, -0.3674536943, -0.1288783401, -0.0563553013, -0.2305456549, 0.3234849572, 0.1497078389, 0.0233156122, -0.0651256666, -0.0555438027, 0.0701146424, -0.1063602641, -0.0443347655, -0.1975313127, 0.0210302155, -0.0967616364, 0.0295417532, 0.0621929318, 0.2017764747, 0.2890487909, -0.2750004828, 0.0504878536, 0.0505750291, -0.0595085658, 0.1866525561, -0.157363072, 0.3616138399, 0.4519872665, 0.031364087, -0.0434336141, -0.1598107666, 0.056544628, 0.0406267904, 0.0759693906, 0.0609645098, 0.3302604258, 0.101079531, 0.6614115834, 0.3625736237, 0.1548633575, 0.3272962272, -0.0050968216, 0.1325637847, -0.2484616339, -0.4285873175, -0.25187096, -0.3223820925, 0.0676499382, -0.2475498617, -0.0832688436, -0.453787297, -0.3686931729, 0.4809544086, -0.4484333098, -0.2922632396, -0.0461665764, -0.473153919, 0.2454742342, -0.0141626401, -0.0119090462, -0.0777527988, -0.0021201069, -0.2190320492, 0.2599601448, 0.0750971287, -0.3458838165, -0.2463167906, -0.337068975, -0.4683036804, 0.3457071185, 0.1800266802, 0.6090078354, 0.0361392573, -0.0807514936, -0.0433468968, -0.1559733301, 0.8825862408, -0.6140748262, -0.3779460192, 0.2825071216, -0.3890221417, -0.2425139993, -0.1773129851, -0.0925869495, 0.605871141, 0.3386296928, 0.4422081411, -0.1263382137, -0.2924231291, 0.2054612041, -0.1899688989, -0.0901449323, 0.0126365703, -0.3751443326, -0.0160287153, -0.2455603331, 0.0628635585, -0.2198967189, 0.1254922301, -0.2943683565, -0.0085716136, -0.0713990107, -0.1021113172, 0.1646036953, 0.0390508324, 0.0290780663, -0.1818821579, 0.0904804915, 0.0928516164, 0.1154309511, 0.2179582864, 0.2940431237, -0.3483683765, -0.1547676772, 0.1047961339, 0.0128386375, 0.2593705952, 0.287494719, 0.2066311091, -0.0999754146, 0.1383376271, 0.1219355687, -0.2631673217, -0.0537209623, 0.3026967943, -0.0508231036, -0.5315153599, -0.1201047227, -0.0578831472, 0.4363302588, -0.1913834512, 0.5237945914, -0.4564825594, -0.2383582294, 0.3694998324, 0.0153902182, 0.8982657194, -0.4066661, -0.0524985306, 0.0174787417, -0.0084767081, 0.1157459691, 0.0991771147, 0.0434688702, -0.3183641434, -0.0740955994, -0.0107522029, 0.0392736979, 0.2415271401, 0.106719397, -0.1916188896, 0.4355040491, 0.0005614324, -0.0736709982, -0.0178324003, 0.1360593438, 0.3495913446, -0.0522041246, 0.1100697145, -0.0046375045, -0.0166385211, -0.0884451941, -0.0157269705, -0.0205741152, 0.2720364928, -0.232376799, -0.4313635528, -0.0588855036, -0.1246226132, 0.1750724763, 0.1152961925, 0.0633789003, -0.0505628437, 0.0899277106, -0.0465700179, 0.136165604, -0.0849652141, -0.0713880137, 0.1129711717, 0.3522197008, 0.1447093487, 0.0274932887, 0.2665856183, 0.0795497149, -0.2798363268, 0.0733126029, -0.2621833682, -0.2616210878, -0.0750689805, 0.0655352473, -0.0213130601, 0.1660889536, 0.1111551896, 0.0022650096, -0.1481417865, -0.2251985371, 0.0727069154, -0.0243666358, -0.0966149047, 0.5090480447, -0.0795829073, -0.3521080017, 0.0703077167, 0.4957984388, 0.2781367302, -0.1033786163, 0.1932803541, 0.1098287404, 0.0112323174, -0.2096004337, -0.2345392406, 0.144998312, -0.1942834407, 0.2652490437, 0.0830777958, -0.1989106089, 0.2920129597, 0.0552812926, 0.0793018416, 0.3829925358, -0.1570690721, -0.2903124988, -0.5277744532, 0.2857144475, 0.0204583369, 0.0969084725, -0.1263668835, 0.1305980533, -0.0521105118, 0.3383784592, -0.2322705835, 0.1291425824, -0.0689733103, 0.1807764471, -0.0222007986, -0.0191036221, -0.1341446936, -0.139324069, 0.064647451, 0.0359887369, -0.2040904015, -0.0415780507, 0.0906357989, 0.1251114905, 0.0482726991, -0.1485893875, -0.1163556352, -0.0774999931, -0.0856593922, -0.1161115319, 0.1988504678, 0.2801807821, -0.170732826, 0.1351587325, 0.1905765533, 0.1141844168, 0.120203115, 0.380643487, -0.2339487076, 0.0605882555, 0.0225696042, 0.371925205, 0.121101357, -0.2014990449, 0.0049363128, 0.0348658636, -0.1434594393, 0.0187816788, 0.3351597488, -0.2365336865, -0.0248170681, 0.0341961794, 0.3707671463, 0.4022576511, -0.0860797316, 0.1595239788, 0.103832908, 0.1220130622, -0.0071793208, -0.2172746062, 0.4551471472, 0.0618553385, 0.0393965021, 0.2695763409, 0.2744850814, -0.1645930856, 0.2384147942, 0.2020522952, -0.1007002741, -0.0349233076, 0.2911988795, 0.2524303496, 0.1633522213, 0.1991355121, 0.2327961773, -0.2741601765, -0.1227261275, 0.2849216461, -0.0553044006, 0.494032979, -0.0550818667, 0.0939502567, -0.0180263016, -0.6432765722, 0.0468904264, 0.1129793376, -0.5432621837, 0.2139879763, -0.014376292, 0.2575622499, -0.3294780552, -0.4762939513, -0.1783712208, 0.4282785356, -0.2955002189, -0.3060945272, -0.191506058, -0.1794613451, -0.0360155739, 0.0738013387, -0.0777122527, 0.251794219, 0.7757792473, 0.0437462367, -0.0749629512, -0.1485754251, -0.3636280298, 0.0480315126, 0.3650008738, -0.0165604427, 0.3460436165, 0.0974888355, 0.0123904701, 0.0072355545, 0.2230304033, 0.5292613506, 0.6800273061, -0.4986771643, 0.0286408812, 0.1742098182, -0.0936605036, -0.1186066046, 0.3716339767, 0.1848438978, 0.264590323, 0.2285881639, -0.0288326256, 0.01114552, -0.1483449638, 0.2338470966, 0.3835114539, 0.078224659, 0.2400390804, 0.1224802285, -0.1629376113, 0.2473017871, 0.1672243625, -0.3199605048, -0.2731570601, 0.5410599113, -0.3435690105, 0.1883390099, 0.1087424383, 0.0782316998, 0.1328064203, 0.5063024759, 0.3657384515, 0.0652461946, -0.3326126933, -0.2014547586, -0.4707188606, -0.0253032073, -0.2051990628, 0.3350788951, 0.0426930152, 0.0332995653, -0.0573371239, 0.0522836149, 0.0825940967, -0.2957434058, 0.3538033664, 0.3220771551, -0.5336774588, 0.2130994946, 0.1855690032, -0.0482997522, 0.037356846, -0.3035819829, 0.3494933248, 0.0925251842, -0.0680241883, 0.0800442696, 0.1540370733, 0.115998067, 0.2276994437, 0.0035317801, 0.273909688, 0.5416816473, -0.0236292593, -0.0608468279, -0.2412253469, 0.0493032709, -0.0706123188, -0.0246936418, 0.0966270491, 0.3412884474, -0.2193375677, -0.0735444054, -0.0155458041, 0.1029610783, 0.0029367926, 0.1824572533, -0.4736457467, 0.1919768751, 0.2427233607, 0.0934372395, -0.1141403243, 0.4848994911, 0.1436387002, 0.3039219677, -0.3430656791, -0.2384907454, 0.3032130599, 0.0595476106, -0.1561749279, -0.5542382002, 0.2285562605, -0.1924533695, 0.150056079, -0.5447404385, -0.310798943, 0.1632042974, -0.1011640802, -0.5235194564, 0.2352230996, -0.1159069836, -0.1001254469, -0.0555107258, -0.2853476703, 0.1060264483, -0.1125022322, 0.1802149117, -0.0616506338 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
> The parallelism is automatically disabled on `tokenizers` when the process gets forked, while we already used the parallelism capabilities of a tokenizer. We have to do it in order to avoid having the process hang, because we cannot safely fork a multithreaded process (cf [huggingface/tokenizers#187](https://github.com/huggingface/tokenizers/issues/187)). > So if possible, the tokenizers shouldn't be used before the fork, so that each process can then make use of the parallelism. Otherwise using `TOKENIZERS_PARALLELISM=false` is the way to go. Ok thanks :) Is there something we should do on the `datasets` side to avoid that that the program hangs ? Also when doing `.map` with a tokenizer, the tokenizer is called once on the first examples of the dataset to check the function output before spawning the processes. Is that compatible with how tokenizers are supposed to be used with multiprocessing ?
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
140
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` > The parallelism is automatically disabled on `tokenizers` when the process gets forked, while we already used the parallelism capabilities of a tokenizer. We have to do it in order to avoid having the process hang, because we cannot safely fork a multithreaded process (cf [huggingface/tokenizers#187](https://github.com/huggingface/tokenizers/issues/187)). > So if possible, the tokenizers shouldn't be used before the fork, so that each process can then make use of the parallelism. Otherwise using `TOKENIZERS_PARALLELISM=false` is the way to go. Ok thanks :) Is there something we should do on the `datasets` side to avoid that that the program hangs ? Also when doing `.map` with a tokenizer, the tokenizer is called once on the first examples of the dataset to check the function output before spawning the processes. Is that compatible with how tokenizers are supposed to be used with multiprocessing ?
[ -0.4756870866, -0.1844160557, -0.0169961043, 0.204991594, 0.081993036, -0.1816115826, 0.2112885416, 0.2972383797, 0.121988073, 0.1559846997, 0.0783842579, 0.4451449811, -0.386464566, 0.2127694637, -0.3733439445, -0.0014690161, 0.1317390352, -0.1153583825, -0.1595414728, 0.2606372237, -0.2197673619, 0.3095827401, -0.2703735828, 0.1662525982, -0.5590299368, 0.03846284, -0.0322678462, 0.2863253951, -0.054948438, -0.6010499597, 0.2577679753, 0.3555742502, -0.0043139579, 0.453980267, -0.0001233048, 0.1498546302, 0.3030834496, -0.0515439063, 0.0069509558, -0.3851674795, -0.0252815858, -0.2770889401, 0.2699130774, 0.1735980362, 0.2168495357, -0.0784445852, -0.1051157117, -0.2321282029, 0.3105885983, 0.3287061155, 0.0884089172, 0.371316582, 0.3021603823, 0.1215194985, -0.0908216834, 0.1545794159, -0.0447720848, 0.06363938, 0.3348869681, -0.2771940529, -0.1457323134, 0.2240810692, -0.2541383803, -0.2269083411, -0.1373942643, -0.2417160124, 0.5890158415, -0.5875573158, 0.2012945712, 0.0768412724, -0.3183763027, -0.0541419648, -0.4318968356, -0.2669734955, -0.3097963035, -0.4587303102, 0.218555063, -0.0512983464, -0.1742660552, 0.1737106889, -0.4497327507, -0.2364096344, 0.0335572064, -0.0911896005, -0.0923883542, 0.5922755599, 0.1959979981, 0.3030861616, 0.189218998, 0.1432414651, 0.0748298243, -0.0224433187, -0.0954667106, 0.1679121703, -0.4035380781, 0.0827432945, 0.0919434205, -0.2895829678, -0.1892667413, 0.0969897583, -0.2585221529, 0.1280374527, -0.1369834393, 0.0878550112, 0.384493351, -0.040792577, 0.168269977, 0.283328861, 0.2176352441, -0.1963156909, 0.0822508335, 0.0322843455, 0.2650048733, -0.0385890193, -0.1799197644, 0.2314646691, 0.1087993458, -0.1337116808, -0.1423172802, 0.1458654404, -0.068199046, -0.129616037, 0.1331931949, 0.2315076441, 0.0405017845, 0.7244011164, 0.0960811824, 0.157588467, -0.3393118083, -0.0529346541, -0.0782695487, -0.081207417, -0.3169770241, 0.1219124645, 0.2087178677, 0.0912896246, 0.0224033706, 0.0469063371, -0.3484089375, -0.2333081812, 0.1524539441, -0.2576985657, 0.1139874235, 0.6639271379, -0.0942202806, 0.0524130464, -0.0007993201, -0.057426624, 0.037214268, 0.2017597854, -0.4929461777, -0.164047718, -0.244307518, 0.0716860667, 0.0040531526, 0.2785006166, -0.2109917402, 0.3353478312, 0.3713304102, -0.3363818824, -0.2624812424, -0.3061409295, -0.3731998801, -0.2744423151, 0.0567432679, 0.2622539103, -0.3388673961, -0.1239292696, 0.0962542146, -0.2862996161, 0.3363775909, 0.3003761768, 0.004522088, 0.0158559475, -0.1642982513, 0.2672317922, 0.0184794739, -0.2350243777, -0.0645949617, 0.214182049, -0.066981636, 0.382589221, -0.0254144669, -0.2721018493, 0.4200842977, -0.0821268782, 0.2206921875, -0.071971111, -0.159852922, 0.0723825023, -0.4469227791, -0.0518160388, -0.0820842981, -0.1019435897, 0.3698018491, 0.1915020943, -0.1476292163, -0.5076677799, 0.2738441229, -0.0926944315, 0.3278763592, 0.0927442089, 0.1244725361, 0.1748362333, 0.1179584339, -0.2395220697, -0.415840745, 0.2211659104, -0.2326013297, 0.0300398674, -0.0494021215, -0.0657085851, 0.1601952016, 0.2033798099, -0.2015706003, -0.1870107055, 0.0405647866, -0.0309698731, -0.270085156, -0.0150519805, -0.1966943294, 0.580350697, 0.0635139719, 0.2283321321, -0.07833267, 0.2001927793, -0.1512624174, -0.4348412156, -0.3166469336, 0.2367543727, 0.0390147045, -0.0944889486, -0.1714596748, 0.4456484318, 0.4693534076, -0.0102846567, -0.0764802769, 0.1878217608, 0.2870835662, -0.1167797297, -0.1751217544, 0.0338014662, -0.0003316993, -0.1464110017, 0.3196181655, 0.4675674736, 0.2330543399, 0.3575595617, 0.2539697587, 0.2081483006, 0.343967557, 0.0218104031, -0.024278013, -0.1146609187, 0.2205081582, -0.0994283929, 0.2154528201, -0.0023474048, -0.1119076386, -0.1728880554, 0.0676755309, 0.0434732735, -0.1648949534, 0.0478622392, 0.0696720257, -0.1340031624, 0.2139620483, -0.0598308109, 0.3442216516, 0.0206977464, -0.1673966497, 0.1541669965, -0.2430065721, -0.0026991472, 0.0961448103, -0.0014896384, 0.3433481455, 0.3187735379, 0.0600362159, 0.0198896863, -0.2822585404, -0.3517170846, 0.1048055291, 0.3378387392, -0.4633424878, 0.2322873324, -0.2338479012, 0.3845454156, 0.1340384036, -0.1681765616, -0.3353672624, -0.556654036, -0.0958941132, 0.5814810395, -0.1384190321, 0.1703566164, 0.0081470069, 0.1842132211, -0.2478106767, 0.4309316576, -0.2272590399, -0.3418932259, -0.2030450404, -0.1250691861, 0.3325463235, -0.2567775846, 0.2517680526, 0.1759165525, -0.2938838601, 0.0872063935, -0.3873683512, 0.1526652873, -0.0731864274, 0.0602890998, 0.1090698391, -0.0157845654, 0.0045561045, -0.2544359863, 0.1518449187, -0.235000208, -0.2803880572, 0.2101808786, -0.1396775097, -0.0038291144, -0.2559751868, -0.2211222053, -0.4681302905, -0.1458349228, 0.0394945629, -0.2275545001, 0.2909943461, 0.0990903452, -0.0002405572, 0.0341755599, -0.1882957369, 0.0580973811, -0.0850368664, -0.0544362962, -0.2630151212, 0.0116213728, -0.1198362187, -0.064238593, 0.060650114, 0.1806459874, 0.3339759707, -0.2563076913, 0.1001730785, 0.0493986681, -0.0370887257, 0.1855916381, -0.2218177319, 0.3342914581, 0.371094048, 0.0414134003, -0.0081442185, -0.123391673, 0.1171030328, -0.1319321394, 0.004658646, 0.0892828703, 0.3490759432, 0.2013566047, 0.7101207972, 0.3344254792, 0.0820885524, 0.4097698927, -0.1185182557, 0.1328537166, -0.1741559952, -0.420897752, -0.1677476019, -0.2943629622, -0.0208642147, -0.1777104586, -0.1070090607, -0.3720281124, -0.234851107, 0.4854688942, -0.3625718057, -0.2823327184, -0.0557363667, -0.3887000382, 0.2692975998, -0.0867178142, 0.0599012114, -0.1011542231, 0.008538913, -0.1931377351, 0.3219673932, 0.1452972293, -0.298517406, -0.3974404633, -0.1347712278, -0.5677655339, 0.2774598598, 0.1943188012, 0.7197502851, -0.0222189818, -0.0550327376, 0.0424782038, -0.1738960296, 0.933565855, -0.3680357039, -0.4003143609, 0.2850962877, -0.5228554606, -0.2758198678, -0.1567970663, -0.1825539321, 0.5299731493, 0.5033148527, 0.4867070615, -0.2295979708, -0.3556587994, 0.0830109641, -0.2391571999, -0.1092303544, 0.0121596847, -0.3224847019, 0.0144700799, -0.2834956348, 0.1093766913, -0.2248121798, 0.1295710653, -0.2389337718, -0.0865683109, -0.0915004313, -0.139709428, 0.1736969501, 0.0825340077, -0.0099505614, -0.2765923738, 0.0427070521, 0.1082735062, 0.0614705905, 0.2878067493, 0.1701038033, -0.2898445129, -0.2364211679, 0.1754239202, 0.1405266374, 0.287101537, 0.2971282899, 0.1893925518, 0.0590799451, 0.1080006287, 0.2241966724, -0.3453711569, 0.1258983612, 0.3439378142, 0.0436475575, -0.523955524, -0.0237530526, -0.0868226811, 0.4585831165, -0.1333041042, 0.5331060886, -0.3373068869, -0.2532939613, 0.3776794374, 0.053782668, 0.8072377443, -0.3265660703, -0.0229223333, 0.156232208, 0.0173012819, 0.153785333, -0.0873932391, 0.0119428225, -0.3142172396, 0.063477084, -0.0452585481, 0.0772979856, 0.3754210472, 0.1355508864, -0.110525161, 0.3550401926, 0.0733521134, -0.0283134226, -0.0541693531, 0.2516597509, 0.3914584816, -0.1080615297, 0.1057132557, -0.0169226341, -0.0128005091, -0.090020135, -0.001877099, 0.0472423173, 0.2725729644, -0.1645089686, -0.4301680923, -0.1503295898, -0.1936088055, 0.169972986, 0.1953964531, 0.202821061, -0.0608460829, -0.06898316, -0.0499989353, 0.1060871929, -0.1081337035, -0.0966312736, 0.0212482419, 0.2923197746, 0.145278275, 0.0103633786, 0.3265816867, 0.0780172125, -0.196809113, 0.0214369725, -0.2279840857, -0.2474514544, 0.0210346244, 0.0023376776, 0.1069786474, 0.1279896498, 0.1304860562, -0.0097237574, -0.1147375479, -0.2371560037, 0.0243881308, 0.0176019408, -0.1802403331, 0.3344121277, -0.0578749403, -0.3232227266, -0.03330395, 0.4687099159, 0.1090972051, -0.1480858773, 0.087135382, 0.1562367678, -0.0553739928, -0.1955141723, -0.2417646646, 0.3024611175, -0.138302058, 0.2691164911, 0.0501744635, -0.3383750319, 0.1524506211, 0.118290633, 0.0824208111, 0.2784633636, -0.2389618605, -0.3424566984, -0.5004398823, 0.3107460439, -0.0229353383, 0.1211041957, -0.0049039749, 0.2242473662, -0.1838407516, 0.3456742465, -0.2167029232, 0.0904567987, -0.1229844317, 0.1570653766, -0.1399086267, -0.0782787427, -0.1073132902, -0.0705691874, 0.0576644056, 0.0072550136, -0.2576484978, -0.0122713828, -0.0123426486, 0.1236552149, 0.1437782943, -0.2519906759, -0.0008612684, 0.0077840663, -0.1153551042, -0.2093736827, 0.2162918448, 0.3250149488, -0.237407282, 0.0713873208, 0.2589741647, 0.2015164495, 0.0900137126, 0.306914717, -0.1149786413, 0.0090329628, 0.0585633405, 0.4187966585, 0.0750647336, -0.1738540977, 0.0440641865, 0.1432626396, 0.0831822306, -0.057664074, 0.2839288712, -0.1335041672, -0.0173587333, -0.0663813353, 0.4031856656, 0.4276713431, -0.0851340517, 0.0137510803, 0.178594172, 0.0751702115, 0.0693163127, -0.2387712598, 0.6134285331, 0.0490219109, 0.1219350845, 0.2915587723, 0.3574240208, -0.0887226313, 0.1632321626, 0.1584092826, 0.0630488098, -0.0033901108, 0.2510578036, 0.0251805, 0.0141693596, 0.3006722033, 0.2103434056, -0.3132789731, -0.1205043122, 0.2594990432, -0.0557235703, 0.6039002538, -0.1152231619, 0.2057898045, -0.0456066206, -0.6763283014, 0.0114664529, 0.0381748676, -0.4961699545, 0.2350896448, -0.0345539749, 0.2672607005, -0.2967123389, -0.475669086, -0.1563878804, 0.5736589432, -0.3739907444, -0.3585554659, -0.2344926447, -0.1247159615, -0.0726851448, 0.035706386, -0.0670150742, 0.1927327961, 0.6713905334, -0.0255351923, -0.053272292, -0.2078121603, -0.3529202044, -0.0205995664, 0.2887109816, -0.0138300965, 0.4510283172, -0.0193171836, 0.0346368477, -0.0704787672, 0.2078047991, 0.4842168689, 0.6428657174, -0.3257590234, -0.1031229123, 0.0446993746, -0.0426338464, -0.1281031966, 0.4979902506, 0.0402994603, 0.2436811477, 0.2387834936, -0.0687587708, -0.0063498742, -0.3184900582, 0.347750783, 0.2925031185, 0.0784481168, 0.3953697085, -0.0102351867, -0.1058874577, 0.2256117463, 0.0787452087, -0.2978064716, -0.2154135406, 0.4452060461, -0.4718311429, 0.2071366459, 0.1623842567, 0.0543015338, 0.0993550494, 0.4279837608, 0.3365134299, 0.0190368146, -0.2900010645, -0.1771737933, -0.4373068213, 0.0562304966, -0.1554322988, 0.3129949272, 0.0160790179, -0.0343840495, -0.027572453, 0.0940408036, -0.1088185087, -0.1512671709, 0.3697280586, 0.2707335651, -0.5438628197, 0.3023400605, 0.0414217226, -0.0839154348, 0.0237432141, -0.2340020239, 0.4112955332, 0.0445199497, -0.1232691705, 0.1092155129, 0.1708801538, 0.0304025393, 0.0013582864, 0.032527905, 0.3359395564, 0.5460199714, -0.0598559082, -0.0129342871, -0.2739144564, 0.0819798931, -0.1434947997, -0.0431735143, 0.0291470494, 0.4516672492, -0.1946020871, -0.0968336761, -0.0568243712, 0.1586850137, 0.0600403771, 0.1141106263, -0.4758607447, 0.3058165908, 0.1352463514, 0.0754725039, -0.1574520618, 0.455760479, 0.2329504192, 0.383281678, -0.3386000395, -0.2078127563, 0.3144844174, -0.1796896756, -0.0677396357, -0.6403827071, 0.1724695116, -0.0376218855, 0.0543130077, -0.4913702011, -0.3654240072, 0.1549299508, -0.2062966377, -0.5398039818, 0.2500117421, -0.1176325455, -0.2370578349, -0.0799301341, -0.1416479051, 0.1694274843, -0.087323606, 0.2898894846, -0.039770782 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Hmmm I pulled the latest commit, `b93c5517f70a480533a44e0c42638392fd53d90`, and I'm still seeing both the hanging and the key error.
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
18
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Hmmm I pulled the latest commit, `b93c5517f70a480533a44e0c42638392fd53d90`, and I'm still seeing both the hanging and the key error.
[ -0.3769077659, -0.1904279292, -0.0374411158, 0.1203724071, 0.0553162545, -0.1488190591, 0.2511083186, 0.3369264007, 0.1473492533, 0.1732963324, 0.1061455905, 0.4089753628, -0.402579844, 0.3307686746, -0.3633013964, 0.0771412477, 0.113956362, -0.0854944885, -0.2521776855, 0.2545395494, -0.2573971748, 0.3191767037, -0.3519817889, 0.1498742849, -0.4931677282, 0.0434545912, -0.0665593222, 0.2185115069, 0.0069522806, -0.5854379535, 0.3268181682, 0.3247091472, -0.0737521127, 0.417165339, -0.0001270815, 0.0950682163, 0.3749818206, -0.0569982938, -0.0621220879, -0.322950691, -0.2003952712, -0.1734237969, 0.3260557353, 0.1571724415, 0.2158145905, 0.0487520173, -0.120958589, -0.2518001199, 0.2916256487, 0.3332444727, 0.0684019551, 0.2374103367, 0.2859759033, 0.0629965514, -0.0574422516, 0.1290603131, -0.0421771184, 0.0746059567, 0.3901986182, -0.3858203888, -0.1070059612, 0.2573369145, -0.218855679, -0.2458664924, -0.1455920786, -0.2127301544, 0.7035226226, -0.6686064601, 0.2560440302, 0.0739468709, -0.1959523261, 0.0557755902, -0.4045493305, -0.2214631587, -0.1872925758, -0.3897366524, 0.2885861993, -0.0384369045, -0.2220059037, 0.1508982629, -0.4666241407, -0.2990282476, -0.02540241, -0.091008991, -0.1253380477, 0.5177984834, 0.2228848338, 0.3107624948, 0.2196395844, 0.1078674421, 0.1268883049, 0.0262999032, -0.0399365351, 0.1460580528, -0.3875404894, 0.1230900213, 0.1270537972, -0.0346091948, -0.2650230825, -0.0606251992, -0.316619277, 0.1118734628, -0.0469084941, 0.0298337229, 0.4266043603, -0.1204851568, 0.1959402859, 0.2868336141, 0.299755007, -0.197270155, -0.0210938156, 0.0749312937, 0.3320277631, -0.0966068655, -0.0451823659, 0.2595970631, 0.1397741586, -0.2171106488, -0.12644656, 0.2199629247, -0.0300101601, -0.1575809717, 0.0745055005, 0.2125532478, 0.0536562651, 0.7686823606, 0.1733050793, 0.1522125155, -0.3153268993, 0.0211218912, -0.056755472, -0.0981144309, -0.335958153, 0.0658254251, 0.2510721087, 0.0283315182, -0.0049024504, 0.0512576811, -0.2201681584, -0.2804393172, 0.0260843057, -0.233493641, 0.0855752081, 0.7288821936, -0.1311662644, 0.0851640478, -0.060670983, -0.2393743694, 0.0579014122, 0.2445375174, -0.4499721825, -0.1594577134, -0.2083013952, 0.069231838, 0.0207369216, 0.2660788298, -0.0923079103, 0.2476324886, 0.3904183507, -0.3749099374, -0.2846360505, -0.35983181, -0.3236690462, -0.2998531759, -0.0062104915, 0.2738518417, -0.414865315, -0.0681547895, 0.0381254554, -0.1951264739, 0.2469148338, 0.1701106429, 0.0047403364, -0.004063895, -0.1401056945, 0.0848199651, 0.0337083116, -0.2646331191, -0.1709017307, 0.3487450778, 0.0507283844, 0.3495715857, 0.0308209434, -0.2441288829, 0.3451979458, -0.1635714024, 0.2934058905, -0.1475644261, -0.1938302666, -0.0110448655, -0.3982697725, -0.0040059714, -0.1653377414, -0.0277197398, 0.3931813538, 0.1603293419, -0.1570053548, -0.4206725061, 0.3244020939, -0.0621508583, 0.291778028, 0.0633130893, 0.0832027644, 0.0400555842, 0.1159483343, -0.2447223216, -0.588796556, 0.2484188378, -0.2199753523, 0.0512511954, -0.1405695826, 0.0062953704, 0.0613512546, 0.2660132647, -0.218273446, -0.1511555761, 0.0010988114, -0.110125415, -0.3123205602, -0.0099407239, -0.2225747555, 0.633865118, 0.1779183298, 0.1317066848, -0.0696566254, 0.1322144419, -0.2103150636, -0.4017415345, -0.2050702274, 0.2375408262, -0.0374557674, -0.0920633674, -0.1554380506, 0.4663215578, 0.4083088636, -0.0508939065, -0.071079582, 0.1463082582, 0.299374938, -0.0992845595, -0.1243378073, 0.0196277592, -0.0481171869, -0.2307186425, 0.1942164898, 0.47859779, 0.1279976964, 0.4742361009, 0.14513807, 0.2324370295, 0.2692561746, 0.0385845229, -0.0693079159, -0.1486955285, 0.2669600844, -0.260435909, 0.201229617, -0.016027214, -0.1401326656, -0.1557423472, 0.1133954078, 0.0463227555, -0.2064401507, 0.0521034524, 0.183555752, -0.1177734658, 0.0970707983, 0.0266080238, 0.3838664293, -0.0120633999, -0.1649733782, 0.1629100591, -0.3187044561, -0.0670596361, 0.1021069586, -0.0751304477, 0.3526101708, 0.359205097, 0.0093880259, -0.0652728081, -0.1116800606, -0.2466431111, 0.086915791, 0.4097521603, -0.4359945059, 0.1810719371, -0.2512142956, 0.3177020848, 0.1722839028, -0.1079264134, -0.3008711934, -0.6829920411, -0.0988098234, 0.4672754109, -0.0280366894, 0.1316036433, -0.0585719049, 0.0979007035, -0.2034886926, 0.3690123558, -0.2601798773, -0.3610712588, -0.1307525337, -0.1165757626, 0.3876148462, -0.3217422962, 0.1939664334, 0.1785332412, -0.2623200119, 0.2360370308, -0.3630241752, 0.088937588, -0.1330858171, 0.0983870551, 0.2035269886, 0.0626999214, 0.0286590252, -0.2158978134, 0.1384954751, -0.2482054532, -0.210938409, 0.2669926584, -0.1468042284, 0.0815710947, -0.2717662454, -0.2617189288, -0.4254596531, -0.1215944439, -0.0129351383, -0.2455707192, 0.2889829874, 0.0955774114, 0.0731861368, 0.0277665928, -0.0155602265, 0.0322794653, -0.0874172524, -0.0393872373, -0.1897684932, 0.0770542398, -0.0941975266, -0.0101409005, 0.0946572646, 0.1635849327, 0.247149542, -0.4137738943, 0.0598168001, 0.0181818791, 0.0326773636, 0.2200663984, -0.2045188695, 0.2996487916, 0.4151647687, 0.0442236662, -0.0472325981, -0.1688159108, 0.1457175463, 0.0228530541, 0.0040896148, 0.0625500828, 0.3118418455, 0.1385626346, 0.5838059187, 0.3471313119, 0.1333995014, 0.2966783345, -0.0107630324, 0.162594825, -0.2375049442, -0.342484951, -0.2309471667, -0.2596517503, -0.0357606634, -0.2082084864, -0.0774803013, -0.4753355682, -0.342063278, 0.5736967921, -0.3473557532, -0.2954929769, -0.0182281286, -0.4701855779, 0.1867373288, -0.0581233241, 0.041076865, -0.0324110687, 0.0159691311, -0.2220127583, 0.2033534348, 0.2477432489, -0.3888174295, -0.2757532895, -0.3214167655, -0.5434209108, 0.3417310715, 0.1708779186, 0.649844408, -0.0604274273, -0.0693535358, 0.0671450347, -0.2798388004, 0.9282137156, -0.6133785248, -0.4135127068, 0.3380131125, -0.3858446479, -0.3094111979, -0.1624200493, -0.1247925386, 0.6172779799, 0.427493304, 0.4958396256, -0.1949278861, -0.3422042131, 0.1864223927, -0.2154040784, -0.1390997767, -0.0089294836, -0.3572755754, -0.0246108808, -0.1836158037, 0.0630402043, -0.2271406353, 0.0721594319, -0.233251363, -0.0317148082, -0.065567486, -0.1067605764, 0.1498786062, 0.0699225962, -0.0642875805, -0.1818165183, 0.0786014646, 0.1185865775, 0.0782492682, 0.134402737, 0.1924812049, -0.4369202852, -0.0407999158, 0.1790246665, 0.0244010594, 0.2706047893, 0.3768020272, 0.2354345769, -0.0519160964, 0.1326310039, 0.2377826273, -0.3062330782, -0.0404674858, 0.3642690778, -0.0291333161, -0.5488156676, -0.144597128, -0.0697216988, 0.4107923806, -0.2437296808, 0.4938350618, -0.3520706594, -0.2111813277, 0.4083632231, 0.0432296656, 0.8509258032, -0.4368034601, -0.0274584834, 0.0738659278, 0.0087483265, 0.074661158, 0.0460168906, -0.0211693011, -0.2881325185, -0.022663828, -0.0523689948, 0.0165419579, 0.2664730847, 0.0620558374, -0.1888652295, 0.3902170658, -0.0525777377, -0.022768518, -0.0531624332, 0.1566174775, 0.3568083048, 0.0011243896, 0.120502986, -0.0319026597, 0.0010160923, -0.1539349705, -0.0333329104, 0.0376936086, 0.2755376101, -0.1731654853, -0.4624628127, -0.0863377675, -0.0337373093, 0.1094928011, 0.1800208837, 0.0868438035, -0.0420006216, 0.1443868279, -0.0876281708, 0.1290785521, -0.1049808636, -0.0392891057, 0.0913174152, 0.316760838, 0.2007426322, 0.0527569242, 0.2512257397, 0.0953505412, -0.2729368508, 0.0647850558, -0.2976251841, -0.2978369594, -0.034918718, 0.0663810819, 0.0433264039, 0.1381473243, 0.1084845439, 0.005398883, -0.1620918512, -0.2438485026, 0.0253621843, -0.0496192276, -0.0770036429, 0.5529298782, -0.1073597372, -0.3646470606, 0.0220890213, 0.4827078283, 0.2201133966, -0.0684503466, 0.1795392036, 0.1709264219, -0.0470668077, -0.2419931889, -0.2201523632, 0.1828525364, -0.199295491, 0.3358791173, 0.0801733136, -0.254222095, 0.250511378, 0.0631612837, 0.1032472625, 0.2757009566, -0.2074914873, -0.3126967847, -0.4722813368, 0.2779863775, 0.0353674553, 0.1646440625, -0.1440235227, 0.0844870582, -0.0956173018, 0.3184506595, -0.2017914653, 0.1109797508, -0.1178985089, 0.1734066904, 0.023317175, -0.0683207288, -0.0564723201, -0.0996848792, 0.0616014786, 0.0252547581, -0.2078846097, 0.0018627495, 0.0787152275, 0.1410406977, 0.0153402314, -0.1227158383, -0.0183769688, -0.0836907849, -0.0561203435, -0.1496050209, 0.236217767, 0.2881515324, -0.1598276049, 0.127113238, 0.1638926417, 0.2709271312, 0.1845812351, 0.3855479658, -0.1361585855, 0.0546354987, 0.0643815845, 0.3762479126, 0.1178330705, -0.1927626729, 0.0755717605, 0.1425983608, -0.1473908573, -0.0080329534, 0.3913156688, -0.1805914789, 0.0680831522, 0.0077022822, 0.4710886478, 0.4523407221, -0.0779248327, 0.1208762974, 0.1299078614, 0.069671616, 0.0346482433, -0.1935383081, 0.4906771481, 0.1123974025, 0.0491276905, 0.3103134036, 0.2718248069, -0.2247925699, 0.2421733439, 0.2108755112, -0.0402918011, -0.0609163232, 0.1589467078, 0.2681150436, 0.1229017749, 0.1887984127, 0.2788739204, -0.2783480585, -0.1302314699, 0.2561230063, -0.0551638119, 0.4227167964, -0.0360204168, 0.1916903704, -0.0057649668, -0.5985738635, 0.0967566594, 0.1316302717, -0.5105829239, 0.1886386573, 0.0281333029, 0.2563147247, -0.3215013444, -0.4784177542, -0.2237992734, 0.4910325706, -0.2867059708, -0.3611819148, -0.1705146283, -0.1840227097, -0.0509407297, 0.0617616586, -0.1212100983, 0.1888549179, 0.7641551495, 0.0984371379, 0.0199346952, -0.2188360244, -0.3564907908, -0.1301348954, 0.3811826408, -0.0232565664, 0.3999080658, 0.0608853139, 0.0769784376, -0.0178104416, 0.1241748035, 0.5050506592, 0.617836237, -0.5770909786, 0.0544338934, 0.1402112544, -0.0746735781, -0.1047942191, 0.4415914416, 0.1400592327, 0.3452733159, 0.264351666, -0.0792870745, 0.0287590232, -0.1752514541, 0.3240354061, 0.4146076143, 0.1198318079, 0.3768997192, 0.0824240297, -0.1472590417, 0.3186637461, 0.1207052097, -0.3364005685, -0.306958288, 0.3774548471, -0.4733805954, 0.2193965912, 0.20290187, 0.0530629829, 0.0539452918, 0.5389307141, 0.3228669167, 0.1460401714, -0.2956556678, -0.1743111908, -0.4652699232, -0.1036811247, -0.1289960742, 0.2323552966, -0.0010731182, 0.0631361306, 0.0173695199, 0.0486699417, -0.0112877311, -0.3573033512, 0.3776764274, 0.3754168153, -0.4881599247, 0.2943690717, 0.1610055864, -0.0582349598, -0.0448180549, -0.2514106631, 0.3653366864, 0.0154903913, -0.1032705829, 0.0839192718, 0.1313344091, 0.0639710724, 0.1456250995, 0.0059961448, 0.2952327728, 0.5333592892, -0.003906324, -0.0923863873, -0.2899852693, -0.0016283676, -0.0063388697, -0.0786271393, 0.0183879007, 0.4141324461, -0.1897065938, -0.0324866697, 0.0221521426, 0.0365647115, 0.0039269496, 0.2086858302, -0.434114635, 0.2006958276, 0.1827542782, 0.0372735932, -0.1726938486, 0.4718482494, 0.2118580788, 0.3240711987, -0.2758528888, -0.1918582022, 0.3087022603, -0.0378635004, -0.1339869052, -0.4886541367, 0.2032842338, -0.2365768105, 0.1142093912, -0.5074616671, -0.3361960053, 0.1557460427, -0.1966831684, -0.6136548519, 0.2853869796, -0.0619896613, -0.215458408, -0.0629374981, -0.2218509018, 0.1091928482, -0.1340532899, 0.1599436551, -0.0997044966 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Hi @timothyjlaurent The hanging fix just got merged, that why you still had it. For the key error it's possible that the code you ran reused cached datasets from where the KeyError bug was still there. Could you try to clear your cache or make sure that it doesn't reuse cached data with `.map(..., load_from_cache=False)` ? Let me know if it it helps
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
63
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Hi @timothyjlaurent The hanging fix just got merged, that why you still had it. For the key error it's possible that the code you ran reused cached datasets from where the KeyError bug was still there. Could you try to clear your cache or make sure that it doesn't reuse cached data with `.map(..., load_from_cache=False)` ? Let me know if it it helps
[ -0.3729740381, -0.1859523654, -0.0339066386, 0.129206717, 0.09803541, -0.1325107813, 0.2636091709, 0.4240574241, 0.1391320527, 0.1339373142, 0.04652806, 0.4665991664, -0.369638443, 0.446620822, -0.3270714283, -0.023708228, 0.0842829421, -0.0867141634, -0.2671530545, 0.2537030578, -0.3337043524, 0.2835066617, -0.3157282472, 0.2287002355, -0.4680308998, -0.0196889639, -0.1571887583, 0.2040825337, -0.0384005681, -0.5968236327, 0.3087913394, 0.2592989802, -0.0386931151, 0.4125380218, -0.0001159086, 0.0726361945, 0.2915794551, -0.0694601908, -0.1238342822, -0.4056951106, -0.1630978733, -0.1920110732, 0.279499352, 0.0924810767, 0.1524779946, -0.0606590733, -0.1370132715, -0.1714395732, 0.369210422, 0.2973994017, 0.1916394085, 0.1836926043, 0.3016476929, 0.0850575715, -0.0235231891, -0.0432401635, -0.045025833, -0.0441331714, 0.3562732637, -0.3835229278, -0.1636615396, 0.3938466609, -0.159100771, -0.2558550239, 0.0481431223, -0.203278631, 0.5871524215, -0.6714693904, 0.1936375052, 0.0861368924, -0.1640222371, 0.0897191241, -0.4611236155, -0.2372852564, -0.1507683545, -0.4156847894, 0.2953737676, -0.0046017985, -0.2389932126, 0.1260258853, -0.4238137305, -0.2955451012, -0.0063168169, -0.13942343, -0.0698229522, 0.5199890137, 0.2127798349, 0.2648281157, 0.2387395799, 0.0557522252, 0.1047798172, -0.0716204569, -0.1317557544, 0.2191711068, -0.4095770717, 0.0330453776, 0.1441629529, 0.0376283191, -0.1656431258, -0.1597575545, -0.2449797541, 0.086729221, 0.0025470441, -0.0358657353, 0.4091966748, 0.0254016723, 0.2701696157, 0.2604083419, 0.2943360507, -0.1905033141, -0.0741189271, 0.0486716479, 0.2814121842, -0.114502199, 0.0346962027, 0.3480426073, 0.1715754718, -0.1595718712, -0.0572372638, 0.0996335596, -0.0458175056, -0.1653961986, 0.0432069525, 0.2337243557, 0.0642115772, 0.6473725438, 0.1239024475, 0.1313351989, -0.2320634276, -0.0496823825, -0.1114419475, 0.0055615436, -0.3369036019, 0.0278137475, 0.2164690793, -0.1401567608, 0.0144438101, 0.0348333567, -0.258484751, -0.2159381211, 0.086636059, -0.1109285653, 0.1053566039, 0.6346382499, -0.0904197171, 0.0813512877, -0.0073842108, -0.2797874212, 0.0319331214, 0.2214628458, -0.5432989597, -0.2066185921, -0.0062801153, 0.1853591353, 0.0336938649, 0.1731325984, -0.1481189579, 0.2331714034, 0.3177974224, -0.2863826156, -0.2881161869, -0.2861080766, -0.321698904, -0.3718682826, -0.0147519261, 0.25205791, -0.4537153542, -0.0823263675, 0.015872255, -0.1219128966, 0.1184697896, 0.1592023224, -0.1201317832, 0.124512203, -0.1835375428, 0.1869906783, 0.0609241165, -0.258841604, -0.2698889673, 0.3641795516, -0.0383911841, 0.2907691002, 0.0354468487, -0.1966842562, 0.3934168518, -0.1237006262, 0.3538430333, -0.0550938286, -0.1739275903, 0.019411996, -0.3822779953, -0.0390148014, -0.1381128728, -0.1211567521, 0.405474335, 0.0988968685, -0.2085456997, -0.3918996751, 0.2793353498, -0.1241680235, 0.31253016, 0.0472511724, 0.1341276169, -0.0408251397, 0.2059611678, -0.1856370568, -0.467972964, 0.3226784468, -0.2243600488, 0.0517390631, -0.1350095272, -0.0220244285, -0.0217187945, 0.1625897735, -0.3280450404, -0.2965447307, 0.1462074518, -0.0975859687, -0.1941841692, -0.0213769972, -0.2148848474, 0.5157760978, 0.3289862275, 0.1015794426, -0.1412808597, 0.1307113469, -0.3029308021, -0.3651214838, -0.1901481003, 0.1515970379, -0.010110504, -0.0993066952, -0.2007434219, 0.4787656069, 0.3853655159, -0.0566651709, -0.0514839962, 0.2301513255, 0.2624251544, -0.0285462327, -0.1271883398, 0.105215624, 0.0398714617, -0.136903137, 0.1302663684, 0.6239997149, 0.1339045763, 0.4230163097, 0.1884403676, 0.2562128305, 0.2815239429, 0.0092140678, -0.0580088943, -0.0960733891, 0.1638164818, -0.3738695085, 0.0694387928, -0.0546685755, -0.0387200192, -0.1118888929, 0.2121146172, 0.0672766641, -0.1295357347, 0.065358825, -0.0247472562, -0.0656457469, 0.0686134174, 0.1543726921, 0.3296005428, 0.0632074997, -0.2049696892, 0.1575352252, -0.1924854219, -0.0033682915, 0.2201358229, -0.1017463356, 0.2729799151, 0.3356056511, 0.0168671515, -0.0137432078, -0.1414908767, -0.1968515068, 0.0353918187, 0.4144651294, -0.400929004, 0.1306913942, -0.3032637239, 0.1425555199, 0.2121395171, 0.0424721241, -0.1998409033, -0.6393455267, 0.015874071, 0.3853755593, -0.0572633632, 0.1523914933, 0.0208077468, 0.0435621068, -0.1224136353, 0.3570630848, -0.1496757865, -0.4756734967, -0.1689334214, 0.0046426165, 0.3523488045, -0.3390562236, 0.2837488353, 0.1046040729, -0.2289169729, 0.2102588564, -0.4162887633, 0.0956428424, -0.1570355445, 0.0642079338, 0.1687161922, 0.1463495344, -0.0150520327, -0.2420863807, 0.1787247062, -0.2942126393, -0.3931434453, 0.3215643764, -0.103412509, 0.1561694592, -0.2509376705, -0.4179031253, -0.3237198889, -0.2003943324, 0.002539905, -0.2512458563, 0.252478987, 0.1682387441, 0.0705054402, 0.0267116558, -0.0970102474, 0.0801039115, -0.0571683273, 0.076510407, -0.149786979, 0.0077674459, -0.2464170456, 0.0273186751, -0.0277021844, 0.1303970814, 0.1635614783, -0.3969525397, -0.0190885104, 0.0411074758, 0.143268466, 0.2680861354, -0.1667962968, 0.380082339, 0.3647362888, -0.0318775214, -0.0121161863, -0.0928803682, 0.0071054986, 0.0735903829, 0.0149996411, 0.0612242147, 0.3435928524, 0.1424991637, 0.6854366064, 0.2752222717, 0.1665730774, 0.2465547323, -0.0247273128, 0.1074364558, -0.3065448999, -0.3919323981, -0.2665605843, -0.3089667559, 0.00543164, -0.1595830917, -0.056978818, -0.435171634, -0.261517942, 0.3561649919, -0.3579083383, -0.3693563342, 0.076467067, -0.4184986055, 0.1878629625, 0.0158673562, 0.0569496006, -0.0557551011, 0.0530098379, -0.1381235719, 0.2112244815, 0.2029325664, -0.4287494421, -0.2992617786, -0.3367244601, -0.4790399969, 0.3524400294, 0.1396892816, 0.4911386371, 0.0711005703, -0.1520290822, 0.0255534407, -0.2880279422, 0.8684402704, -0.6372084618, -0.4212188423, 0.293273747, -0.4309197664, -0.3340885937, -0.1677618027, -0.2115841508, 0.6215445995, 0.404741019, 0.6619134545, -0.1441090107, -0.306740135, 0.0630455688, -0.0505906492, -0.160454154, 0.0117189661, -0.2843123972, -0.0188124701, -0.3132393062, 0.0902740136, -0.2285682112, 0.1387684941, -0.2473485917, -0.04489097, -0.0667260736, -0.182761848, 0.0605004765, 0.1177205071, 0.0207159407, -0.1789888144, 0.1849313676, 0.0713652447, 0.1505002677, 0.1448426396, 0.2358930707, -0.387240082, -0.0403514989, 0.1115829349, -0.0157176908, 0.1632236987, 0.3018371463, 0.119111605, 0.0477824062, 0.1097645685, 0.1298588514, -0.2769140899, -0.1139096618, 0.3287647963, -0.0388903394, -0.4032017887, -0.2041194141, -0.0893790722, 0.3325065374, -0.2921118736, 0.4312384129, -0.2718982697, -0.1908378601, 0.4886585176, -0.0745828822, 0.7769596577, -0.3349072933, -0.0066603036, 0.0609167777, 0.0300633889, 0.1367228925, 0.1239458844, 0.0436866321, -0.3786577284, -0.0925657898, -0.0124077275, 0.0585333221, 0.2362628281, 0.0588805899, -0.2678051889, 0.363471061, -0.0307005569, -0.0799859166, -0.1024516448, 0.2062173039, 0.2626483738, -0.0335403159, 0.1019344553, 0.0622215085, 0.0284092259, -0.0071155424, -0.0046360949, -0.0091661243, 0.2356940806, -0.3067144752, -0.4391649961, -0.1244045645, -0.0712275952, 0.160468623, 0.1113620102, 0.025993472, -0.0110033806, 0.1811233163, -0.0262443814, 0.1916252077, -0.108316265, -0.0665973499, 0.0885276049, 0.2978014946, 0.1572388858, 0.0032184108, 0.2674491405, 0.0098747909, -0.2708141506, 0.0919782445, -0.2495938838, -0.2325695753, 0.0245084353, 0.0437906124, -0.0755677149, 0.1149440408, 0.1390469968, -0.05725931, -0.2020317018, -0.2990484536, 0.1250750273, -0.0670376718, -0.1480725855, 0.504977107, 0.0004374752, -0.3364853263, 0.0603949204, 0.5290409923, 0.3188912272, -0.0273062047, 0.3020719886, 0.1057571918, -0.022416655, -0.3198133409, -0.1011003703, 0.3219783902, -0.1888060719, 0.2999121249, 0.0288368631, -0.1429736465, 0.2914671004, 0.1589840353, 0.2008524537, 0.324157536, -0.2165280432, -0.2855884135, -0.4925098419, 0.3401562274, 0.069253929, 0.109618634, -0.170963943, 0.0120273586, -0.0885960087, 0.3379904926, -0.3164949119, 0.0990835801, -0.1227277219, 0.176485464, 0.0475691445, 0.0167666897, -0.0642426908, -0.072629489, 0.1442050487, 0.0324134417, -0.2022999078, -0.1341395676, 0.0567398332, 0.0862879977, 0.0451298244, -0.0931860581, -0.0640826151, -0.1119965911, -0.0435156487, -0.1591752023, 0.2522533238, 0.2442684621, -0.1731222421, 0.1908839047, 0.1939111501, 0.1710811406, 0.1297672093, 0.3485622406, -0.2650258541, 0.0747029707, 0.0642915964, 0.3440958261, 0.1167636216, -0.170427084, -0.0454203784, 0.049313914, -0.2381975651, 0.0777193531, 0.3738659024, -0.1637313664, -0.0200512316, 0.0756100491, 0.4149123132, 0.376221329, -0.0997752994, 0.1957228184, 0.1410349458, 0.1938936859, -0.0605850406, -0.2219108194, 0.3633992374, -0.0010874764, 0.1359813958, 0.2581402063, 0.2731424272, -0.1009999514, 0.1861302257, 0.173533842, -0.0997622833, 0.0171634331, 0.1727566123, 0.3383667171, 0.094493337, 0.1121393293, 0.2775925696, -0.3374082446, -0.1136411503, 0.2190267593, -0.1272084713, 0.4180165827, 0.0461267009, 0.1783936024, 0.0522113852, -0.5796560645, 0.226004526, 0.0386143737, -0.4828645885, 0.0830073506, 0.0876453295, 0.1291489154, -0.2772060931, -0.4099135697, -0.1989887208, 0.4446932375, -0.3052485883, -0.3082731962, -0.2460542321, -0.2431774884, -0.076323539, 0.0364753194, -0.1299949884, 0.1892969906, 0.6870549321, 0.0264353026, -0.0380800851, -0.1530597359, -0.2805671394, -0.036931999, 0.4131476283, -0.0874879584, 0.3061194122, 0.1116383597, 0.0818894655, 0.0151323518, 0.1614598483, 0.522588253, 0.6355863214, -0.5816591978, 0.0809554085, 0.1785975546, -0.1300258189, -0.1261998862, 0.3898411393, 0.1103925332, 0.3445352614, 0.3547881544, 0.0350760445, -0.0407642201, -0.0740594491, 0.2384991348, 0.3921906054, 0.0455204695, 0.2923432589, 0.1365063488, -0.129721418, 0.2803794146, 0.179773435, -0.3314747214, -0.324724406, 0.4075753391, -0.3387224674, 0.2173646837, 0.0483185947, 0.1162084043, 0.0322412066, 0.5574448705, 0.3594413996, 0.0940397754, -0.3318676651, -0.0865828395, -0.5268971324, -0.0841359571, -0.2359139174, 0.1518825293, -0.0689226687, 0.1092916876, -0.0044614854, 0.124438107, -0.0152091151, -0.3844551444, 0.3050991893, 0.4490071833, -0.4907382131, 0.1813879609, 0.3065485656, -0.0227141269, -0.0300963838, -0.300401628, 0.3344732523, 0.0385640673, 0.0250894111, 0.1233911365, 0.0685885623, 0.177724719, 0.0547108017, 0.047029037, 0.2941529453, 0.5331445932, -0.061708156, -0.0615420304, -0.2617752552, -0.0059646755, -0.1172560826, -0.0979967713, 0.1279917508, 0.4231702685, -0.0840478837, -0.1946537346, -0.0175150204, 0.1063798815, -0.0377557576, 0.1182324439, -0.404391855, 0.2538505197, 0.212000832, 0.0213683918, -0.1611507237, 0.441686362, 0.1101303771, 0.1553227454, -0.2664439678, -0.2475414574, 0.2882623374, -0.043609146, -0.1493016183, -0.4830527008, 0.1681107134, -0.223652944, 0.1611629874, -0.4133827984, -0.2893521488, 0.2315833271, -0.1507376581, -0.5155611038, 0.2117447257, -0.0465029739, -0.1064364165, -0.0427053496, -0.2824112177, 0.0595691837, -0.1379957944, 0.1203346401, -0.0893133879 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Hi @lhoestq , Thanks for letting me know about the update. So I don't think it's the caching - because hashing mechanism isn't stable for me -- but that's a different issue. In any case I `rm -rf ~/.cache/huggingface` to make a clean slate. I synced with master and I see the key error has gone away, I tried with and without the `TOKENIZERS_PARALLELISM` variable set and see the log line for setting the value false before the map. Now I'm seeing an issue with `.train_test_split()` on datasets that are the product of a multiprocess map. Here is the stack trace ``` File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 451, in load_prodigy_arrow_datasets ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/src/datasets/src/datasets/arrow_dataset.py", line 168, in wrapper dataset.set_format(**new_format) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/src/datasets/src/datasets/fingerprint.py", line 163, in wrapper out = func(self, *args, **kwargs) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/src/datasets/src/datasets/arrow_dataset.py", line 794, in set_format list(filter(lambda col: col not in self._data.column_names, columns)), self._data.column_names ValueError: Columns ['train', 'test'] not in the dataset. Current columns in the dataset: ['_input_hash', '_task_hash', '_view_id', 'answer', 'encoding__ids', 'encoding__offsets', 'encoding__overflowing', 'encoding__tokens', 'encoding__words', 'ner_ids', 'ner_labels', 'relations', 'spans', 'text', 'tokens'] ```
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
174
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Hi @lhoestq , Thanks for letting me know about the update. So I don't think it's the caching - because hashing mechanism isn't stable for me -- but that's a different issue. In any case I `rm -rf ~/.cache/huggingface` to make a clean slate. I synced with master and I see the key error has gone away, I tried with and without the `TOKENIZERS_PARALLELISM` variable set and see the log line for setting the value false before the map. Now I'm seeing an issue with `.train_test_split()` on datasets that are the product of a multiprocess map. Here is the stack trace ``` File "/Users/timothy.laurent/src/inv-text2struct/text2struct/model/dataset.py", line 451, in load_prodigy_arrow_datasets ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/src/datasets/src/datasets/arrow_dataset.py", line 168, in wrapper dataset.set_format(**new_format) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/src/datasets/src/datasets/fingerprint.py", line 163, in wrapper out = func(self, *args, **kwargs) File "/Users/timothy.laurent/.virtualenvs/inv-text2struct/src/datasets/src/datasets/arrow_dataset.py", line 794, in set_format list(filter(lambda col: col not in self._data.column_names, columns)), self._data.column_names ValueError: Columns ['train', 'test'] not in the dataset. Current columns in the dataset: ['_input_hash', '_task_hash', '_view_id', 'answer', 'encoding__ids', 'encoding__offsets', 'encoding__overflowing', 'encoding__tokens', 'encoding__words', 'ner_ids', 'ner_labels', 'relations', 'spans', 'text', 'tokens'] ```
[ -0.3455712199, -0.1244765222, -0.0099463901, 0.2436584234, 0.1326491386, -0.1085879207, 0.2091186047, 0.3842709661, 0.1275973916, 0.055418361, 0.0650869235, 0.2885190248, -0.4160086215, 0.3402268887, -0.2788424492, 0.0649460182, 0.1176876053, -0.1377788037, -0.373721987, 0.2305667847, -0.2718405128, 0.3353237808, -0.2338255197, 0.1210064515, -0.5046047568, 0.0449888073, -0.1111247465, 0.3717215061, 0.0684829205, -0.589055717, 0.3367899358, 0.2819589674, -0.0480297878, 0.3480781317, -0.0001237825, 0.1063451022, 0.3847543299, -0.1089712605, -0.0622288063, -0.3263472021, -0.1737762094, -0.1924262196, 0.2838897407, 0.0872730762, 0.1946080625, 0.0350467712, -0.1431172043, -0.2287728339, 0.32980299, 0.3584726155, 0.108955957, 0.2274535894, 0.2610172331, 0.1091633439, 0.0079341382, 0.0144448178, 0.0120127602, 0.0105955377, 0.2656098902, -0.3017510772, -0.1495729834, 0.372289747, -0.2550999522, -0.2173594832, -0.0058809188, -0.219384715, 0.6108900309, -0.5381212234, 0.2770034075, 0.0419183448, -0.2300308645, 0.0360987298, -0.4760310054, -0.2049935162, -0.2889749408, -0.5068154931, 0.3482625782, -0.0966811404, -0.120499067, 0.160767749, -0.5080752969, -0.2501935065, 0.0702678263, -0.1309081018, -0.0440391488, 0.4516031444, 0.2043743879, 0.2419659644, 0.2371710241, 0.1206097305, 0.0828297362, 0.0368180163, -0.1755400747, 0.1539329141, -0.4410712719, 0.0727007911, 0.1501145214, -0.011230832, -0.2254720479, 0.0307366811, -0.1942612231, 0.0992028862, -0.0916412398, -0.0203569271, 0.3888456821, 0.0562037528, 0.1859544665, 0.1347610801, 0.2832924724, -0.1339154094, 0.0400829017, 0.0852166638, 0.3456959426, -0.0811672881, -0.0124407262, 0.413348645, 0.1129975468, -0.2294029891, -0.0599845424, 0.1502424181, -0.0300121363, -0.2148934007, 0.0187902842, 0.1588860452, -0.0029365143, 0.7559261918, 0.1216322556, 0.1799938977, -0.2985371053, -0.1033539549, -0.0879793614, -0.078338787, -0.4462859035, 0.1121376529, 0.2708316445, -0.1769163311, 0.0029230106, -0.0293804202, -0.3343158066, -0.2672932446, -0.005717543, -0.1809577942, 0.103291519, 0.6875528693, -0.1682296097, 0.0362340957, -0.0051767831, -0.0747525096, 0.0804440156, 0.2214311808, -0.5367617011, -0.2646107674, -0.2048505545, 0.0789481848, 0.0069823982, 0.3434107304, -0.0932206959, 0.2554692924, 0.4977131188, -0.3562064171, -0.2382134199, -0.2570954263, -0.437043488, -0.3161763847, 0.0009103189, 0.313516587, -0.3315528631, -0.1214467436, 0.0876631811, -0.158177346, 0.1792080402, 0.263336122, 0.0320781805, -0.0481657609, -0.1246598735, 0.0071643493, 0.0008244079, -0.2042134255, -0.2987395823, 0.1712993383, 0.0336490944, 0.3593222797, 0.0736716986, -0.2474051565, 0.3209017813, -0.1843067706, 0.3235272467, -0.1109328344, -0.1499822289, 0.0182688721, -0.4165967703, -0.0977839157, -0.1438876539, -0.1557714194, 0.4019340277, 0.2475280315, -0.0925158709, -0.4669559002, 0.2758163214, -0.1199946851, 0.3561441302, 0.1221895143, 0.0755644292, 0.0702306107, 0.1730286032, -0.1853508651, -0.6047534347, 0.3041416705, -0.2501337826, 0.0431425981, -0.1477175653, -0.0157312918, 0.1335424781, 0.0891358182, -0.149069041, -0.2978049219, 0.0218345877, -0.0204792861, -0.204593271, -0.0690910146, -0.2441115081, 0.7258078456, 0.1483657807, 0.1382077783, -0.1974515468, 0.1050308943, -0.1945033222, -0.3886589408, -0.2837042809, 0.2788516879, 0.012864979, -0.1279389262, -0.1980296522, 0.3907419443, 0.400169313, -0.0490545519, -0.0479036644, 0.2991718352, 0.2560948431, -0.1387452185, -0.0958265439, 0.0244669486, -0.0276679657, -0.1636605859, 0.2050242722, 0.4712378085, 0.0942037925, 0.4115887582, 0.1363153607, 0.2084510475, 0.3067332804, 0.0051695998, 0.0097786803, -0.1651755273, 0.1741487384, -0.1718351841, 0.2099788487, 0.0183886904, 0.0095014209, -0.1484383494, 0.1744221896, 0.020802835, -0.1467273682, 0.0808340535, 0.0518874712, -0.1830231398, 0.1379193664, 0.0632488877, 0.3419297636, -0.018310193, -0.1588670462, 0.2417917997, -0.1436594129, 0.030284008, 0.1401724219, -0.1044881418, 0.266469121, 0.2962372601, 0.0669786632, 0.0796570405, -0.1835869104, -0.154777512, 0.0871741101, 0.3825926185, -0.4576373696, 0.1936837882, -0.2836958766, 0.2762710154, 0.2124968916, -0.0819848627, -0.321993947, -0.5981810093, -0.0910403207, 0.5325676203, -0.0922538415, 0.1659385264, 0.0012376126, 0.156172812, -0.1698637009, 0.399418056, -0.2692891061, -0.4219844639, -0.1239217296, -0.129248932, 0.3829293549, -0.4229314923, 0.2115245759, -0.0087400796, -0.2595655024, 0.1289769411, -0.3988408148, 0.0933483541, -0.1177261993, -0.0403880253, 0.1544981897, -0.0220289212, 0.0301759746, -0.1615736783, 0.1917389631, -0.3205643892, -0.35250175, 0.2628384829, -0.1099281088, 0.1426186413, -0.3057216406, -0.2488423586, -0.3357538879, -0.0755686909, -0.0051653902, -0.26573053, 0.3179176152, 0.2084106207, -0.0123670334, -0.0700817779, -0.1287321895, 0.0919009745, -0.1273196042, -0.1091578454, -0.2312930375, 0.0972519368, -0.1596219987, 0.0335750021, 0.0853757486, 0.1164718568, 0.3502857089, -0.3690613508, -0.0689096376, 0.0925488099, -0.0223241802, 0.229108274, -0.1680187136, 0.3719294369, 0.4319142997, 0.0209557451, -0.0569458753, -0.2369538397, 0.0805418789, 0.0453718491, 0.0599123724, 0.12125054, 0.3780145943, 0.142028451, 0.7747806907, 0.2866214514, 0.0910939723, 0.3499986529, -0.028316455, 0.2063766271, -0.2522655129, -0.3935123682, -0.2120957822, -0.3562319875, 0.0119806454, -0.1822085828, -0.1161307618, -0.3244530857, -0.2922693193, 0.4655034244, -0.3842082024, -0.2641273141, 0.023634525, -0.5137664676, 0.207669884, -0.0357885398, 0.0154689876, -0.0819851533, -0.0316872448, -0.1261826009, 0.2762477696, 0.072456196, -0.2466897666, -0.1857018173, -0.2622129619, -0.5433810949, 0.3920851052, 0.2058963776, 0.580100894, 0.0003779021, -0.0944948643, 0.0310258698, -0.1828489304, 0.9522315264, -0.4960356951, -0.346689105, 0.2083467394, -0.545558989, -0.0968326107, -0.1612384021, -0.1376571208, 0.5284408331, 0.3635908067, 0.4567362368, -0.1420129538, -0.3185373545, 0.1275019795, -0.227551043, -0.1594371647, 0.0970045328, -0.3764309287, -0.0169397388, -0.2257394046, 0.0497245118, -0.284127444, 0.0744780079, -0.2121135294, 0.0725717843, -0.0414902903, -0.1092953384, 0.0846452415, 0.012382485, 0.0425305292, -0.1751032919, 0.0125153288, 0.1235082746, 0.2027814537, 0.2298821658, 0.3496076465, -0.4466884732, -0.0730665401, 0.1103932932, 0.0605577752, 0.1754445136, 0.3381386101, 0.189244464, -0.0406996235, 0.202244997, 0.1370731145, -0.2748180628, -0.0869928822, 0.3566797674, 0.0427997112, -0.4777278602, -0.1417576373, -0.0164193232, 0.3961029351, -0.2092302591, 0.4785839021, -0.3369476497, -0.2643271089, 0.3273870349, 0.0282704625, 0.8502171636, -0.3952552676, 0.0811004415, 0.0051097232, 0.0029541641, 0.234865278, 0.067219846, 0.0788504034, -0.2991182208, -0.068263568, -0.0635968596, 0.0854783803, 0.2161599249, 0.0640435964, -0.134224847, 0.474964112, 0.019198237, -0.0096894689, -0.0696132705, 0.0654877499, 0.4006586075, -0.0159190092, 0.0287459772, -0.0263754241, -0.033013586, -0.0150101203, -0.0109567875, -0.0315054171, 0.2435775101, -0.2060919851, -0.3993579149, -0.0928606689, -0.1005686224, 0.1672326028, 0.2263248712, 0.0712781101, -0.1681401283, -0.0114671122, 0.0234827623, 0.0354609564, -0.0957324058, -0.1205085665, 0.0795381069, 0.3757040501, 0.1605424583, 0.1067805737, 0.324284941, 0.0916085914, -0.2471612394, 0.0538609698, -0.2858957052, -0.3169014454, 0.1146844849, 0.0705759749, 0.0022969437, 0.1854237318, 0.1068824902, -0.0222489554, -0.1199304461, -0.2102941722, 0.0326753408, 0.0129163684, -0.1103707999, 0.3514620066, -0.1062306687, -0.3452735543, 0.0387972221, 0.5714833736, 0.1792282611, -0.1365398765, 0.1708631814, 0.1084279492, 0.0061465064, -0.1767273843, -0.3147132099, 0.1856325716, -0.1824866086, 0.2496792823, 0.050475385, -0.3122133017, 0.2068661302, 0.1525934637, 0.152928859, 0.4311656654, -0.1888732314, -0.3375232518, -0.5552378893, 0.3313269019, 0.0134997657, 0.0687702, -0.0746563524, 0.0384716056, -0.0967091843, 0.3323038518, -0.2229069173, 0.0763912126, -0.0844009221, 0.1326910555, -0.0582742393, -0.0666018575, -0.0561770275, -0.1351223737, 0.0327474065, -0.0399704017, -0.3238808215, -0.0252360702, 0.0375822783, 0.1396387815, 0.0788785443, -0.1851932257, -0.081433028, -0.0081885047, -0.045556698, -0.1865729541, 0.2877727449, 0.3394421637, -0.154463768, 0.2089519948, 0.233116731, 0.1577551365, 0.057817895, 0.3292007446, -0.1893488467, -0.0028625554, -0.0109864408, 0.3587946594, 0.0093152411, -0.1553911716, 0.1088602841, 0.127476275, -0.125247255, 0.0000303279, 0.3466127515, -0.186986044, -0.0326905996, -0.0120869428, 0.4094200134, 0.3499453068, -0.0911723524, 0.0539569519, 0.0707106143, 0.0874182656, -0.0165348519, -0.2206018269, 0.4769597352, 0.1111514121, 0.0399641767, 0.33318308, 0.385743767, -0.2357189655, 0.3037242293, 0.1749236882, -0.0326317139, -0.0436578728, 0.2259698808, 0.1887938976, 0.1417436004, 0.2702080607, 0.3282845318, -0.2589626908, -0.1217819899, 0.3115175068, 0.0219227355, 0.5094076991, -0.0482711419, 0.1318747997, -0.1260089725, -0.6924304366, 0.1770565808, 0.1194024459, -0.4325998724, 0.1958502233, -0.0499772541, 0.246294871, -0.2728315294, -0.4944811165, -0.1602725238, 0.480196774, -0.2971931994, -0.3529888988, -0.143814221, -0.1685842127, 0.0178843141, 0.1029441953, -0.1220701337, 0.2627574503, 0.8705646992, 0.001340808, -0.0940673649, -0.1132528931, -0.4790526032, -0.0430617407, 0.3615498543, 0.0103333965, 0.4478524327, 0.1272516996, 0.010014765, 0.0303878132, 0.2453124225, 0.4614394605, 0.5924243927, -0.412895143, 0.015274452, 0.1953641474, -0.0158196464, -0.1098344922, 0.4632721245, 0.1278031319, 0.2036516815, 0.1503853798, -0.0878529325, 0.0157423038, -0.0646653324, 0.2157686055, 0.324413389, 0.0953293666, 0.3323197961, 0.061221391, -0.150476411, 0.246720016, 0.2314827144, -0.2850703895, -0.3031417727, 0.4654028118, -0.4126181304, 0.2292831689, 0.1793419421, 0.0684705898, 0.1095161289, 0.5616858602, 0.4272274077, 0.0376743115, -0.2462728173, -0.1341669112, -0.4806020558, 0.0521210544, -0.1457830667, 0.3216112852, 0.0292444509, -0.0412231274, -0.0230936129, -0.0139864953, 0.0510889515, -0.2876896262, 0.32423383, 0.2073320597, -0.6163627505, 0.2550120056, 0.0732989535, -0.0790688023, 0.0205271151, -0.246768564, 0.3759614229, 0.0571836196, -0.0936129615, 0.1096083149, 0.1519053578, 0.0314317644, 0.1592655927, -0.0070396867, 0.2722209692, 0.5062953234, 0.0325849466, -0.1097387299, -0.2741951942, 0.0390070602, -0.0975882411, -0.0104550077, 0.0155984629, 0.3920153975, -0.2077857852, -0.0883225054, -0.0510442369, 0.3311131895, 0.0445094034, 0.0752524585, -0.4925262928, 0.2965705991, 0.1937415451, 0.044945769, -0.0557092167, 0.4923800528, 0.1975070238, 0.2907032967, -0.3964491189, -0.1536384374, 0.3064301908, -0.1346027404, -0.101817742, -0.5227097273, 0.2753641605, -0.2127100527, 0.0281954613, -0.5799023509, -0.2829041481, 0.1240262911, -0.1634379625, -0.6094948649, 0.2030109614, -0.183946237, -0.1443094164, -0.0127472868, -0.2461772859, 0.1673193574, -0.1142708883, 0.1095996797, -0.1046537906 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Thanks for reporting. I'm going to fix that and add a test case so that it doesn't happen again :) I'll let you know when it's done In the meantime if you could make a google colab that reproduces the issue it would be helpful ! @timothyjlaurent
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
47
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Thanks for reporting. I'm going to fix that and add a test case so that it doesn't happen again :) I'll let you know when it's done In the meantime if you could make a google colab that reproduces the issue it would be helpful ! @timothyjlaurent
[ -0.4121120572, -0.1406525373, -0.0332483612, 0.2547088265, 0.1527834386, -0.1575673968, 0.3005400002, 0.2842245102, 0.1220513135, 0.1786371619, 0.1057424992, 0.4333915114, -0.4509957433, 0.4070866406, -0.3537719846, 0.0146764461, 0.1161234304, -0.0957585275, -0.3474510312, 0.2302016765, -0.2869654596, 0.2845573127, -0.3517576456, 0.1021787524, -0.5433183312, 0.1019153744, -0.0670116097, 0.2673820853, -0.0081466762, -0.5242774487, 0.3323918879, 0.235448122, 0.0166099817, 0.4473764598, -0.0001247603, 0.105400078, 0.4095134735, -0.0857340246, -0.0827229768, -0.3554015458, -0.2497746497, -0.1529172212, 0.3264891803, 0.1437778771, 0.1948261261, 0.1137633324, -0.1099196896, -0.2486580014, 0.2269989401, 0.4095127583, 0.0959754139, 0.1484626383, 0.2599981129, 0.1074937806, 0.0507761501, 0.1133369058, -0.0529266559, 0.0704244599, 0.3206127286, -0.3827877641, -0.0285133813, 0.2651741505, -0.2205006629, -0.2288650423, -0.1529173106, -0.1964249015, 0.5769404769, -0.6709401011, 0.206327185, 0.0575008504, -0.1395633221, 0.0107135754, -0.4084625542, -0.1748315096, -0.2404251248, -0.5073002577, 0.2954610288, 0.073222734, -0.1645457894, 0.1377576739, -0.5124664307, -0.2298982441, -0.0507234409, -0.0670409128, -0.1249319315, 0.5671177506, 0.1926734447, 0.2503544688, 0.172529459, 0.116662018, 0.225291118, 0.0004577293, -0.1084871665, 0.1727090329, -0.4143944085, 0.0668922961, 0.0559623055, -0.0301124714, -0.2576622665, 0.0049351742, -0.2148029655, 0.1003774181, -0.1257176101, 0.0608674288, 0.4142848849, -0.0701469406, 0.1900147349, 0.274854362, 0.2734548151, -0.202254042, 0.0313610137, 0.027647851, 0.3244476616, -0.0992103666, -0.0978160724, 0.3083828986, 0.1657085419, -0.2255908996, -0.1998538971, 0.1551358104, -0.1435678601, -0.1698983163, 0.0583344102, 0.1578019857, -0.0012234234, 0.7389060855, 0.1697744727, 0.2071860731, -0.2773305774, -0.0702122152, -0.0462488458, -0.0458044745, -0.3989474177, 0.1445709914, 0.2839931846, 0.0619038902, -0.0171848796, 0.0610630773, -0.3289616406, -0.289817512, 0.1121150106, -0.2676970959, 0.0600717366, 0.6653485298, -0.0666876137, 0.0173052009, -0.0513035692, -0.1929865777, 0.1065105721, 0.2754731476, -0.5094783306, -0.1835174263, -0.2386028916, 0.0853220448, 0.0016960151, 0.2611217499, -0.1982411593, 0.2716644108, 0.3829976916, -0.3211615682, -0.2798919976, -0.3254051507, -0.3995461166, -0.3155680597, -0.0366556235, 0.3317927718, -0.4338262975, -0.0076309489, 0.0181092508, -0.1475033462, 0.323269546, 0.1963199526, 0.0090146465, -0.0334048569, -0.0844936594, 0.0571832471, 0.0135906804, -0.173754856, -0.0926607475, 0.2674303651, 0.0592568666, 0.3397595286, -0.0784268901, -0.267464608, 0.2675082386, -0.1609192491, 0.3010759056, -0.0502840467, -0.1990889609, 0.0589141697, -0.4480961561, -0.0225975458, -0.0723856539, -0.0604242496, 0.3800568879, 0.2501866221, -0.1262992173, -0.5661559701, 0.2953267097, -0.1131386906, 0.3038971126, 0.0671968535, 0.1728439778, 0.0754974708, 0.1271314174, -0.2823399603, -0.5102092028, 0.2077347636, -0.2473967224, 0.0669736639, -0.0537820756, 0.0269371588, 0.1027748436, 0.1855366081, -0.182742238, -0.1951306164, 0.0312553123, -0.0589822344, -0.3378647566, -0.0385567658, -0.1812933087, 0.6933580041, 0.1202344745, 0.1226821765, -0.1053096354, 0.2600258291, -0.165094167, -0.4068416655, -0.2427135855, 0.1782925874, -0.0046843989, -0.0679924041, -0.193895489, 0.469029218, 0.4765937626, -0.0957908109, -0.0227425955, 0.1581678391, 0.2636250854, -0.2274555862, -0.1249526963, 0.0475178398, 0.0494189635, -0.1901455224, 0.176947549, 0.4724966586, 0.0835906044, 0.4071724713, 0.1771291494, 0.2576019764, 0.2519412637, -0.0027740938, -0.0431507789, -0.1274017543, 0.1881029159, -0.1360896081, 0.1354996562, 0.0153028844, -0.1911495179, -0.1967402846, 0.0656924695, 0.0238861777, -0.1781355292, 0.0698435828, 0.0506461821, -0.0983652323, 0.1394212544, 0.0915659592, 0.415784061, -0.015922321, -0.2074047774, 0.2007090896, -0.2526383102, -0.0316542313, 0.1466479003, -0.0746336728, 0.4457936585, 0.2905400395, 0.1170274839, 0.0396162644, -0.1530807465, -0.2957581282, 0.0840764865, 0.380464673, -0.5017097592, 0.2247671485, -0.2366139144, 0.3143700361, 0.0710460842, -0.1635517627, -0.3381691575, -0.5497386456, -0.1408770531, 0.5135912299, -0.0627142042, 0.0747208446, -0.0036529184, 0.0951412022, -0.2184601724, 0.3544717431, -0.1666017622, -0.3664504588, -0.1646610945, -0.0982067585, 0.3514310718, -0.268401891, 0.2071600556, 0.1605091542, -0.2898547351, 0.1963264495, -0.3250335157, 0.0755515471, -0.0649647862, 0.0667987317, 0.0770853087, -0.0536138229, 0.0180141982, -0.1801131368, 0.1070770025, -0.1326914728, -0.2237787098, 0.2805932164, -0.1523411423, 0.0745679587, -0.2608847618, -0.317651242, -0.4118555486, -0.0885939151, -0.0634896979, -0.1984793544, 0.3380073607, 0.1842391193, 0.0384360962, -0.0361019485, 0.0183379985, 0.0001206026, -0.0855408534, -0.0190594364, -0.1976470649, 0.0187300555, -0.1217799932, 0.0045978995, 0.0779645443, 0.0880387425, 0.4316266179, -0.3409135044, 0.0082468148, 0.0334051475, -0.1302685738, 0.2284380794, -0.2176262587, 0.3201878667, 0.4128196836, 0.0741940215, -0.0453656167, -0.2277772725, 0.082858853, 0.0422930308, 0.0735567585, 0.1102713048, 0.2954920232, 0.0971602648, 0.577976048, 0.3713934124, 0.1077599451, 0.3553503752, -0.0479932241, 0.1098850891, -0.1997594833, -0.3643081784, -0.1469733268, -0.3254581988, -0.0515600555, -0.2147622854, -0.1002347097, -0.4813913703, -0.3708155751, 0.6098025441, -0.368762821, -0.2261605561, -0.0518783443, -0.5061079264, 0.258156091, -0.1039816141, 0.0180864874, 0.0079531651, -0.0503303371, -0.285500735, 0.1941620559, 0.1236158162, -0.3415814042, -0.1887843907, -0.2972679138, -0.4389137328, 0.3179172873, 0.2152688503, 0.6413887739, -0.0004073965, -0.0335088149, 0.0526654348, -0.1484396458, 0.8724440932, -0.6391434073, -0.3901262283, 0.3212070167, -0.389272362, -0.230548352, -0.1832406968, -0.2340836525, 0.5545518994, 0.3665710986, 0.4201631844, -0.0816424266, -0.2458471805, 0.231658265, -0.1978907734, -0.1097210124, 0.033149071, -0.3254033029, -0.0265203267, -0.1062935442, 0.0646466389, -0.2433366776, 0.0923803002, -0.2778442502, -0.0833831951, -0.0638620555, -0.053360071, 0.2049310356, 0.0473103188, -0.0129926018, -0.1951615959, 0.0472442806, 0.0210986752, 0.143559441, 0.2934769094, 0.3029739559, -0.4163863957, -0.0815627575, 0.1727877408, -0.0032639718, 0.2762570381, 0.3233977854, 0.2592425942, -0.1373686343, 0.0007328794, 0.1996780783, -0.2637887895, -0.0252385493, 0.3556056619, -0.0455442034, -0.5671124458, -0.1211099997, 0.0051765563, 0.4199862778, -0.1998376846, 0.5653176904, -0.3575084209, -0.2795488536, 0.4127805829, 0.1079264879, 0.8483621478, -0.3829790056, -0.0730304047, 0.0671947673, 0.0268008877, 0.1179678664, 0.1064170897, 0.0879062861, -0.3112837672, -0.0391735435, -0.056288816, 0.0275169611, 0.2479703873, 0.1572479159, -0.2271205038, 0.410071075, -0.052096542, -0.1381068081, -0.008578849, 0.1033738554, 0.393239826, -0.0094014946, 0.1235437617, 0.002807132, -0.0387007818, -0.1200743541, 0.0052091461, 0.0790052414, 0.2419166565, -0.1296010464, -0.5135243535, -0.0410000235, -0.133532688, 0.0750279352, 0.229786694, 0.0510992631, 0.0216671918, 0.1184395105, -0.0464344434, 0.0676526725, -0.143588841, -0.0928342938, 0.0835633874, 0.317004472, 0.1958114058, 0.0367337912, 0.3408837914, 0.093685925, -0.2502162457, 0.0252608303, -0.2338947803, -0.2264738828, -0.0180614199, 0.0726361871, -0.0585118607, 0.1486908793, 0.1381901503, 0.0091721611, -0.1144133955, -0.191119343, 0.0475960933, -0.0709195212, -0.0892756805, 0.5210027695, -0.0350489058, -0.373011142, 0.0119761787, 0.4310202301, 0.2444378287, -0.0667295083, 0.1065038294, 0.160396263, 0.0003413557, -0.2310715318, -0.2428834438, 0.1716857404, -0.1189796031, 0.3094242215, 0.038129434, -0.1944819242, 0.2528367639, 0.0619289838, 0.032272581, 0.3911171556, -0.1844835877, -0.3591225445, -0.4126451015, 0.2500075698, 0.0484348014, 0.1106884703, -0.1846466959, 0.1446647495, -0.0302460492, 0.2589551508, -0.2122108787, 0.1527973115, -0.101826869, 0.2051258683, -0.0535930209, -0.00083546, -0.0993243232, -0.1431497037, 0.0514931306, -0.018561881, -0.1838875711, -0.0198911782, 0.0312996954, 0.1376206428, 0.0847333297, -0.1993037313, -0.060102284, -0.066564098, -0.1236637607, -0.2029263079, 0.2158675641, 0.3959045112, -0.2078517675, 0.1407667994, 0.1893226355, 0.1952368915, 0.1439822018, 0.3243103027, -0.2149885148, 0.0778921098, 0.0814793929, 0.4155633748, 0.1775701493, -0.1909878105, 0.0620323755, 0.1037420332, -0.1445658058, -0.0004131098, 0.3068569303, -0.2390924543, 0.0455288738, -0.0586906113, 0.4123046398, 0.4355721772, -0.1179858297, 0.1110969037, 0.1410022974, 0.1002047434, 0.0493217967, -0.147181198, 0.4749161303, 0.1149629354, 0.0238514151, 0.3524884284, 0.2848343253, -0.14699018, 0.1850554496, 0.163667202, -0.0338793769, -0.0026763873, 0.2539983094, 0.0815502405, 0.0690928847, 0.2622003853, 0.1822580397, -0.3103900552, -0.1121329293, 0.2957110405, 0.0121204713, 0.4673570096, -0.0692834929, 0.0651764199, -0.0891270339, -0.6329885125, 0.0578955002, 0.1388346255, -0.5441830754, 0.2122361809, -0.0096858013, 0.261407733, -0.3864081204, -0.4462727308, -0.1971576959, 0.4130578339, -0.2505246699, -0.3078998029, -0.2264646292, -0.1703546941, -0.1269652396, 0.1096107662, -0.096549876, 0.1930413246, 0.8255367279, 0.0335468352, -0.1240111515, -0.1953442693, -0.3356648982, 0.0009229052, 0.3389831185, -0.0118951127, 0.3929480016, -0.0182969682, 0.0001004106, -0.0541468561, 0.1687266231, 0.4923535883, 0.7186236382, -0.5203194022, -0.0086599877, 0.1379934996, -0.0658949763, -0.0626947209, 0.3690220118, 0.1728775948, 0.2969072759, 0.2561486959, -0.0660468861, 0.0455560461, -0.1087193489, 0.3275894523, 0.3738716543, 0.0244511124, 0.291244179, 0.0596286692, -0.0805850029, 0.2058670372, 0.0789365917, -0.3390072882, -0.2918816805, 0.4837102592, -0.4562890828, 0.231436044, 0.2614200413, 0.044342149, 0.106717281, 0.4937185347, 0.3471804559, 0.1562868208, -0.2608991265, -0.2374812663, -0.3877950013, -0.0001014517, -0.1960657686, 0.3422500193, -0.0291250739, 0.0112804305, -0.0700280666, 0.0646046475, -0.0437065624, -0.214072153, 0.3408592641, 0.319329679, -0.5734246373, 0.2057786584, 0.0849361792, -0.0592483059, -0.0117021268, -0.2920573056, 0.3183323741, 0.0405557416, -0.1181763858, 0.0914624929, 0.158492431, 0.067596525, 0.1648001224, 0.0278840084, 0.3071472347, 0.6216837764, 0.0024168077, -0.0157919005, -0.2677760124, 0.019745132, -0.0921238437, -0.0592218712, 0.0696677119, 0.380435437, -0.1587961316, -0.049749013, 0.0476219989, 0.2289706022, 0.0303710848, 0.2470556647, -0.4424961507, 0.1602875292, 0.1941825002, 0.0280082151, -0.1409193575, 0.3804939389, 0.1256976873, 0.3354588151, -0.3165168166, -0.1907716542, 0.2904995084, -0.0006392883, -0.1257483065, -0.603508532, 0.2105587721, -0.1881112456, 0.1225870922, -0.5265964866, -0.3557216227, 0.1513367295, -0.1979538798, -0.5773919225, 0.2608500123, -0.1053140461, -0.1814598739, -0.067998223, -0.2073142827, 0.1469497681, -0.1275480986, 0.1519546509, -0.0671169758 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Thanks @timothyjlaurent ! I just merged a fix on master. I also checked your notebook and it looks like it's working now. I added some tests to make sure it works as expected now :)
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
35
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Thanks @timothyjlaurent ! I just merged a fix on master. I also checked your notebook and it looks like it's working now. I added some tests to make sure it works as expected now :)
[ -0.4193555117, -0.1071407571, -0.0392603241, 0.2147691548, 0.1458775848, -0.1598081589, 0.260438472, 0.3937072754, 0.098954387, 0.1513859779, 0.0195597913, 0.4504708946, -0.363740772, 0.4398679733, -0.319118917, 0.034580674, 0.0604736209, -0.0270153228, -0.390312016, 0.2088317126, -0.2636981606, 0.298949331, -0.3305637836, 0.1506018192, -0.5216234326, 0.1386962533, -0.1130684838, 0.2653170228, -0.1030744687, -0.4939133823, 0.2864598632, 0.2612056732, 0.0879324079, 0.4689684212, -0.000114397, 0.1324707121, 0.3333232999, -0.1248082146, -0.0798087716, -0.4356539845, -0.1579089761, -0.2550662756, 0.2872833312, 0.1007005051, 0.0749272406, 0.0389385261, -0.0903250277, -0.1414096206, 0.2836949229, 0.4652613103, 0.1934157908, 0.2085707784, 0.2621923089, 0.0558453985, 0.0510044731, 0.0678695813, -0.0874516666, 0.0078279693, 0.3059771657, -0.4177972972, -0.1298087984, 0.3312830925, -0.1521878242, -0.213103652, -0.0349629447, -0.1924244463, 0.5803085566, -0.5957255363, 0.2125932127, 0.0949260369, -0.1266431361, -0.008713739, -0.3816845119, -0.1348069161, -0.2131176591, -0.4743331075, 0.2450660169, 0.0600354783, -0.2198235542, 0.1639675945, -0.4446832836, -0.1741559356, -0.0448268801, -0.1304738522, -0.125717476, 0.5451288223, 0.1489351094, 0.2062476277, 0.2068867832, 0.1561341286, 0.236942485, 0.0344263799, -0.0569587871, 0.1895679235, -0.4668980837, 0.0611613393, 0.0921529159, -0.0954742655, -0.2770744264, 0.0083475849, -0.0881189778, 0.1364298761, -0.0016216061, 0.018721886, 0.3237476051, -0.0298316106, 0.1760365665, 0.2339706421, 0.2529139221, -0.1339114457, 0.0106223421, -0.032066986, 0.2401254475, -0.1618900597, -0.1238918677, 0.2203138471, 0.1702690721, -0.2124932408, -0.2123430669, 0.1235532761, -0.0652695447, -0.134129703, 0.0883262232, 0.2103797942, -0.0055050058, 0.6364830732, 0.2363898307, 0.1668306291, -0.3084967434, -0.0742959231, -0.1081770211, -0.0752082765, -0.4380479455, 0.081957981, 0.3093463778, 0.0654766336, 0.0247548036, 0.0464763977, -0.3424575925, -0.1757462174, 0.1699209213, -0.2142258137, 0.0935267583, 0.6487030387, -0.0624318272, -0.0729875341, -0.0194959193, -0.1211732998, 0.1072038412, 0.2887683213, -0.4147419631, -0.175603345, -0.1448327005, 0.1784071028, 0.062477991, 0.1968684196, -0.1354862899, 0.2495197356, 0.341288805, -0.2765166461, -0.2950173318, -0.2627281547, -0.321924746, -0.2649621367, 0.0088391583, 0.1723241359, -0.406788677, -0.0042887195, 0.0150060588, -0.179457888, 0.2717074752, 0.1691125184, -0.0282548647, 0.0070829582, -0.0883460417, 0.0955985337, 0.0768800005, -0.1691040248, -0.1678662151, 0.295283854, 0.0339028016, 0.2496966124, -0.0105178626, -0.236414656, 0.3208423853, -0.0797640979, 0.244471401, 0.0074712611, -0.1422509998, 0.0394447297, -0.4914544821, -0.0142363319, -0.0799176022, -0.0029364675, 0.4351004064, 0.1397291124, -0.1918193996, -0.5129803419, 0.3801809847, -0.1166739836, 0.3654141426, 0.0820593387, 0.1434987634, 0.1009432673, 0.1733537018, -0.2495147437, -0.3573037684, 0.2332868576, -0.2872870564, 0.1226686165, -0.0040785805, 0.009577916, 0.0459844656, 0.0689833984, -0.2158462703, -0.2534332573, 0.1461218745, -0.049732767, -0.2649740875, -0.0695727244, -0.2448034734, 0.6643335819, 0.1081319153, 0.1286107749, -0.1205225214, 0.2059645355, -0.2012666464, -0.4136805236, -0.230035007, 0.1772000194, -0.03377866, -0.0788789466, -0.1963766813, 0.4693376422, 0.4146352708, -0.2028421909, -0.086847052, 0.1255910248, 0.1912126541, -0.1506287307, -0.1443395168, 0.1170538291, 0.0710576549, -0.1876676977, 0.1343064606, 0.5086150765, 0.0340314209, 0.3584802449, 0.2193984091, 0.2494547367, 0.3088571429, -0.0572911724, -0.0569904633, -0.1041017994, 0.1401890069, -0.1657105982, 0.188527897, 0.0321422443, -0.1542481333, -0.2205117047, 0.0744973123, 0.0366966389, -0.2033705115, 0.0992498994, 0.0222154129, -0.0738712773, 0.1572189331, 0.0868033394, 0.4352721572, 0.0814121664, -0.1514410675, 0.2476584166, -0.2685738802, -0.0336245634, 0.189812541, -0.1886326224, 0.3337743878, 0.3131486177, 0.0016618409, -0.0645072162, -0.2526165843, -0.2312237918, 0.1290822029, 0.3988620341, -0.4570882022, 0.1193112805, -0.2042876631, 0.2391607165, 0.0630441755, -0.132551834, -0.2879112959, -0.491448909, -0.0683124363, 0.5388638973, -0.0008215865, 0.1363487542, 0.0390869565, 0.1202899814, -0.1639818698, 0.3817957044, -0.1218736544, -0.339302063, -0.2346854359, 0.0099811302, 0.3615124822, -0.1558510661, 0.2152874619, 0.0898221731, -0.2461384088, 0.1259489506, -0.3414519727, 0.027459152, -0.1188348159, 0.0474602431, 0.0826991126, -0.0263410639, -0.0158583894, -0.1403870583, 0.1464483589, -0.18276456, -0.2847909331, 0.3372772634, -0.1016341224, 0.0589417294, -0.2651585937, -0.3587746918, -0.3944587708, -0.1789947003, -0.0360174365, -0.2031380385, 0.2997395992, 0.1594228894, -0.0117751556, 0.0170340389, -0.0087829996, 0.0573236272, -0.1083473414, 0.0103764711, -0.1428321004, -0.0703978986, -0.2448673248, 0.0341878906, 0.1254529059, 0.1972051412, 0.3103440404, -0.3343867958, 0.0510898679, -0.0141260084, -0.0532008559, 0.2020154148, -0.1372793019, 0.4295086861, 0.3030901253, -0.0185519271, -0.0289915241, -0.1327068359, 0.0661372021, -0.0121596642, 0.1117382869, 0.0266136099, 0.2794807851, 0.1757089496, 0.5257002711, 0.3726460338, 0.1225584224, 0.352709651, -0.0770341009, 0.1140261143, -0.2462855279, -0.4222674072, -0.1674269885, -0.3445952833, -0.0303516518, -0.1905117333, -0.1223336011, -0.4686017632, -0.3261251152, 0.474075377, -0.2929595709, -0.2703281343, -0.0009388747, -0.3815757632, 0.2553582489, -0.010318541, 0.0509465933, -0.0073616714, 0.0065028309, -0.2341535687, 0.2373699248, 0.0275296718, -0.3430079222, -0.2495889217, -0.2013954371, -0.4698578417, 0.3255583644, 0.0736433342, 0.5758503675, 0.0664781183, -0.1557084918, 0.0528418012, -0.1451816708, 0.8551931381, -0.5291436911, -0.4163534045, 0.3530485034, -0.4446541369, -0.2986304462, -0.2293099016, -0.2401954681, 0.4804589748, 0.363056004, 0.4405978024, -0.0835957155, -0.3271421194, 0.2073354274, -0.2588737309, -0.0956458002, -0.0193276182, -0.3289504051, 0.0026643537, -0.1439437419, 0.0806328133, -0.2556234002, 0.1615922898, -0.2231429666, -0.101484485, -0.136071384, -0.1502163559, 0.1863695532, 0.1315478235, 0.0114301648, -0.2366319597, 0.0945363939, 0.0136125935, 0.1998775303, 0.2887661159, 0.2445152104, -0.417581141, -0.1409906894, 0.1858458668, -0.0981280729, 0.252260536, 0.3151224852, 0.2014821917, -0.1213718131, 0.0429503396, 0.148864314, -0.2819696963, -0.0143473353, 0.3474961519, -0.0276893433, -0.4713937938, -0.1396848559, -0.0640942454, 0.3640649915, -0.1863229275, 0.4500078261, -0.4243420064, -0.3039740622, 0.4157575369, 0.0357803069, 0.8078534603, -0.351524204, -0.0082467105, 0.0785527006, -0.0528233759, 0.0444095172, 0.1244347915, 0.1305839121, -0.3808035254, -0.1677160412, -0.0221057553, 0.0908224061, 0.3004826605, 0.159740895, -0.2783437073, 0.357147187, 0.0343677141, -0.1328843385, -0.0370980389, 0.1615803689, 0.3707352877, -0.0322961956, 0.0534359217, 0.0826026946, 0.0088989763, -0.1095328629, 0.0225268509, 0.0060691689, 0.2187008411, -0.1285783947, -0.3923019171, -0.120919466, -0.1604749262, 0.1002307311, 0.1534644514, 0.0861691013, -0.0856874809, 0.0591868535, -0.0495351292, 0.1008598953, -0.1607714444, -0.0901115015, 0.0909274891, 0.3196433485, 0.1687972248, -0.0326878205, 0.3603779376, 0.0404222496, -0.2821493149, 0.0309959482, -0.184784472, -0.2302516103, 0.0924387202, 0.0527894013, 0.0068402593, 0.0545469187, 0.1035419032, -0.0089264428, -0.1424869597, -0.2472644299, 0.1489106417, -0.1039122194, -0.2403703034, 0.4878771305, -0.0406040773, -0.3871284127, 0.0060365228, 0.5196285844, 0.2512228191, -0.0421015881, 0.1161168292, 0.1134917587, -0.0052114413, -0.2603791654, -0.1053167805, 0.3555202484, -0.1472782195, 0.2697659731, 0.0772922784, -0.2323990464, 0.2793723643, 0.1730698347, 0.186433807, 0.3437086344, -0.2330506146, -0.2502615452, -0.5016092062, 0.2002422065, 0.0906713754, 0.1555785388, -0.1567182094, 0.1033438146, 0.0227641072, 0.2380069494, -0.3144082427, 0.1618684828, -0.1278697699, 0.1995829791, -0.0874244198, -0.0639711246, -0.1013249382, -0.1288781911, 0.1278576851, 0.011029142, -0.2183110118, -0.1269756407, 0.041443374, 0.0959978923, 0.090368323, -0.1801791191, -0.0829943866, -0.0894428641, -0.1912934631, -0.1733568013, 0.2130332142, 0.3244562149, -0.2227032483, 0.1553197205, 0.2211146057, 0.0520622581, 0.1144618541, 0.2124031484, -0.2451879233, -0.0374415591, 0.0753425136, 0.3391863406, 0.1671209186, -0.1564787179, 0.0699888393, 0.0722214133, -0.1351472288, 0.0325767398, 0.3185409606, -0.2506428659, -0.0078418804, 0.0133411596, 0.479808718, 0.4465431571, -0.0354571305, 0.0300002377, 0.1677160263, 0.2217456251, -0.06380032, -0.1488429755, 0.4273238182, 0.0264336932, 0.0895143971, 0.2835230231, 0.2823506594, -0.1218491122, 0.1831273139, 0.1957114786, -0.112193346, -0.0428237095, 0.2549168169, 0.1816566139, 0.0929491594, 0.2404344231, 0.245075509, -0.3198015392, -0.1236819625, 0.3709715307, -0.0579796173, 0.4727438092, -0.0739560276, 0.1659104824, -0.1547360122, -0.6035439372, 0.0466977097, 0.099577561, -0.5765849352, 0.1664245278, -0.0589709915, 0.2135979086, -0.3429761231, -0.4492862821, -0.2299192101, 0.3815022707, -0.3193083405, -0.278416872, -0.2968035638, -0.1927315444, -0.1144061089, 0.0155422278, -0.0980921313, 0.2728917599, 0.7926213145, 0.0167062804, -0.0766711384, -0.17611292, -0.3733613193, -0.0104632769, 0.2841353416, -0.0526118614, 0.3761051595, -0.0376654752, 0.007854512, -0.0527078062, 0.2472106069, 0.4495354295, 0.7589015365, -0.4396672845, 0.0291392654, 0.1385425031, -0.0769141912, -0.1264017075, 0.3904380202, 0.2272909135, 0.3436397612, 0.2906420827, 0.0186778344, -0.0276867505, -0.0531579703, 0.1893319041, 0.2868373692, -0.0592093915, 0.2951441407, 0.1460804641, -0.0888967589, 0.1683428138, 0.1084668636, -0.3899183869, -0.2188165337, 0.5099230409, -0.4190784991, 0.2469062209, 0.1433431059, 0.0981122106, 0.0651597753, 0.5027340055, 0.2623902559, 0.076001808, -0.300847739, -0.2206922174, -0.4730150104, -0.0301170442, -0.2012248486, 0.2934898734, 0.0006071074, 0.0507428572, -0.0133373262, 0.0263469871, -0.0222062469, -0.3289549351, 0.2724012733, 0.3368607759, -0.5882843733, 0.2075417787, 0.1327596456, -0.0550438352, 0.006374896, -0.318192929, 0.3201171458, 0.0733075216, -0.0068844222, 0.1621210724, 0.1773039252, 0.1711471528, 0.2259215862, 0.0468776748, 0.2819206417, 0.4912545979, 0.0361805633, -0.0009607688, -0.3127283752, 0.1062097847, -0.150722295, -0.0046323477, 0.1694762409, 0.4342521131, -0.1230454668, -0.1056578681, -0.0087014697, 0.2750093043, 0.0663076937, 0.1348058134, -0.3960786462, 0.2369549572, 0.2314290106, 0.0715242401, -0.1251010448, 0.4445696473, 0.1168591008, 0.2360392511, -0.3626087606, -0.2346957475, 0.2616026402, -0.007833086, -0.1696407795, -0.6140576601, 0.1814791113, -0.2046999633, 0.1055039689, -0.515093267, -0.3300753832, 0.1696693748, -0.1691149026, -0.5518652797, 0.28028965, -0.0358731635, -0.1203283593, -0.0870614275, -0.2423837185, 0.159647733, -0.1952756345, 0.0383123793, -0.1134015471 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
Great, @lhoestq . I'm trying to verify in the colab: changed ``` !pip install datasets ``` to ``` !pip install git+https://github.com/huggingface/datasets@master ``` But I'm still seeing the error - I wonder why?
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
32
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` Great, @lhoestq . I'm trying to verify in the colab: changed ``` !pip install datasets ``` to ``` !pip install git+https://github.com/huggingface/datasets@master ``` But I'm still seeing the error - I wonder why?
[ -0.4416672289, -0.1638823748, -0.0333688259, 0.2726550698, 0.1398596764, -0.1488541067, 0.2888736427, 0.2428044379, 0.1233454496, 0.2103492171, 0.0198596995, 0.5049681067, -0.3793999851, 0.3664862812, -0.3114084005, 0.042224139, 0.0823741183, -0.0164949279, -0.3751583993, 0.2027813941, -0.1774684489, 0.2914335132, -0.3229137063, 0.1249256805, -0.5289021134, 0.0481470712, -0.0232046228, 0.2264145464, -0.1429688036, -0.5102816224, 0.4412216246, 0.2774358988, 0.0068000047, 0.4950695932, -0.0001267765, 0.1621522009, 0.4178572893, -0.1281793416, -0.1998688132, -0.4242437184, -0.284219414, -0.2430696934, 0.3733285069, 0.0529888123, 0.1932425797, 0.1888233423, -0.0460891388, -0.2160017043, 0.2681325078, 0.3944464326, 0.0823459253, 0.2147488743, 0.2474287301, 0.1046158001, 0.0297513232, 0.1779660732, -0.046828758, 0.0709812716, 0.3152908385, -0.2751642764, -0.0240562093, 0.288061887, -0.2587494254, -0.0838414207, -0.2140991688, -0.1705380976, 0.4943109751, -0.6263381243, 0.1955991536, 0.0815577731, -0.1406649798, -0.0748995021, -0.4533852935, -0.2244769484, -0.2576601505, -0.5030202866, 0.2255762815, 0.0383147225, -0.2167300135, 0.118720293, -0.5351100564, -0.2030430734, 0.0226366892, -0.0981147066, -0.1145922169, 0.5615175962, 0.0796509683, 0.3092219532, 0.231721282, 0.2045360059, 0.2542186975, -0.0397203527, -0.0713269487, 0.1538147479, -0.3840871751, 0.0325843506, 0.0669132695, 0.1032207683, -0.199234888, -0.0264018103, -0.2357921898, 0.0283499863, -0.138386324, 0.0962061137, 0.4001835883, 0.0043299492, 0.138394475, 0.287150383, 0.2604062557, -0.1034704372, 0.0161071457, 0.0157794878, 0.3302519023, -0.0691927969, -0.1319173574, 0.3151136935, 0.2251546979, -0.2654109001, -0.2431906611, 0.0499481298, -0.0663369969, -0.2566160262, 0.0794133097, 0.1817844212, -0.0491333343, 0.6901753545, 0.0495949462, 0.1465946883, -0.3301031888, -0.0150011685, -0.0359650515, -0.0239538159, -0.3363147676, 0.0713681206, 0.2595927119, -0.0516901128, 0.0886395946, 0.0327407978, -0.3011175692, -0.2104311287, 0.1050217003, -0.3483009636, 0.0540352464, 0.7567946315, -0.0330231339, 0.106952101, 0.034567453, -0.1978487372, 0.0832139626, 0.2143734694, -0.5603201985, -0.2310545743, -0.2536773682, 0.0324035175, -0.06429483, 0.2737280428, -0.3409029841, 0.221778214, 0.4327419698, -0.3949705362, -0.2841384709, -0.3484717011, -0.379827708, -0.2361614704, -0.0399763174, 0.3014242053, -0.4129750133, -0.0434270948, -0.0027410353, -0.2266342342, 0.4127742648, 0.2082971036, -0.0585959889, 0.0484887026, -0.1754725277, -0.0414131358, 0.1345535815, -0.2448753119, -0.138760969, 0.2229839116, 0.0678844675, 0.3529624939, 0.0010165861, -0.2929706275, 0.2706998289, -0.1585671604, 0.2899978161, -0.1811331511, -0.222300142, 0.0575292595, -0.4279885292, -0.0444761366, -0.1362225562, -0.0758409649, 0.3197181821, 0.1904805601, -0.091735661, -0.4803735018, 0.2914342284, -0.0974821821, 0.2749803662, 0.0469418876, 0.1833523661, 0.0583575256, 0.0860806331, -0.2779418826, -0.5560166836, 0.1758853346, -0.1128364876, 0.0734609887, -0.1819994301, -0.0033156511, -0.0047650756, 0.2145400494, -0.207802996, -0.1872451752, 0.0109829139, 0.0678199306, -0.2397839725, -0.0476464294, -0.1803409606, 0.7802556753, 0.0948860943, 0.140701592, -0.1968694478, 0.2188933045, -0.1770650297, -0.3737703264, -0.2619193792, 0.2147622406, -0.0545190424, -0.1538219452, -0.2200832963, 0.396157831, 0.4616061747, -0.1174416691, 0.0055232705, 0.1043647006, 0.2650129497, -0.1628607064, -0.1947045773, -0.0392284617, 0.0907206535, -0.125707671, 0.150894776, 0.3900070786, 0.0292398073, 0.3952742517, 0.1306955367, 0.1663775295, 0.3614395857, 0.0658564195, -0.0800636187, -0.1253147572, 0.1883155406, -0.0916728377, 0.1900224835, 0.0967750177, -0.1025893688, -0.1702998728, 0.197915718, 0.0816698447, -0.2172450423, 0.0747727826, 0.1999745518, -0.1187728494, 0.2165576071, 0.1139417961, 0.4971821904, -0.0219784621, -0.1903032064, 0.1335119754, -0.2798819244, -0.016076697, 0.1259058118, -0.0240721069, 0.3989955187, 0.2772562504, 0.1201240718, 0.0499583222, -0.1512105614, -0.3175322115, 0.0898068622, 0.427267164, -0.4888765216, 0.271061331, -0.268869549, 0.2669655085, 0.0520051867, -0.2310131043, -0.2184808254, -0.5585612059, -0.1386852413, 0.4793068171, -0.0087357676, 0.1128479987, 0.0227435492, 0.0532076359, -0.1948923767, 0.3044198751, -0.2504921257, -0.3013236225, -0.1368227303, -0.1110470444, 0.3174392581, -0.2189763933, 0.1903360635, 0.0410234146, -0.280803889, 0.1614136398, -0.3627011776, 0.1494130045, -0.1711047888, 0.2128978521, 0.1890968978, 0.0244966317, -0.0382207073, -0.1943715811, 0.1044635251, -0.1192780435, -0.296919018, 0.1680941433, -0.1942646354, 0.0368099846, -0.2712196708, -0.3120831549, -0.4605068862, -0.0989575833, -0.0250402782, -0.1841688454, 0.2989394963, 0.1648741513, 0.033309374, -0.00421545, -0.0330410674, 0.0822722688, -0.1137124151, -0.2012421787, -0.2248909473, 0.0750419572, -0.098669067, -0.0048670769, 0.0550268404, 0.190547049, 0.3111850321, -0.3943757415, -0.1212723479, 0.0237767305, -0.0814213082, 0.2374360114, -0.0792716816, 0.3408544958, 0.3825592399, 0.1019416153, -0.0926318318, -0.272211194, 0.0375122912, 0.0219184682, 0.1019782275, 0.0665000901, 0.3042421937, 0.1053648591, 0.6797082424, 0.4086299837, 0.0721288025, 0.3929721117, -0.1085145473, 0.2568469048, -0.2528786361, -0.5017322898, -0.163062498, -0.3097390234, -0.0505198985, -0.1380236745, -0.1240746826, -0.4375978708, -0.3680296242, 0.629522264, -0.4248673916, -0.2594052255, -0.1028576791, -0.358377248, 0.2096516639, 0.0284385607, 0.0086303838, -0.0358936936, 0.0070899031, -0.276052177, 0.31606251, 0.090887621, -0.2581807077, -0.1830149293, -0.3940324783, -0.4978415668, 0.3102757633, 0.2822066844, 0.5873107314, -0.0067520277, 0.0540216826, 0.0516173989, -0.1117564365, 0.8583493233, -0.5854831934, -0.4201729, 0.2404562533, -0.3516247272, -0.2097994089, -0.1688064337, -0.2396239638, 0.591894269, 0.4185767472, 0.398537904, -0.225215286, -0.3151474595, 0.3050107062, -0.1486115307, -0.0294344742, 0.0809884742, -0.4181891978, -0.1203427762, -0.2003679574, 0.0380934887, -0.2143436074, 0.093827799, -0.285396874, -0.0301858597, -0.0720047653, 0.0014538722, 0.2060997486, 0.1112164259, -0.0534038283, -0.0441469401, 0.012957707, -0.0271880943, 0.1129580364, 0.2813895941, 0.4119315743, -0.4542776942, -0.1205617189, 0.1787268966, 0.1203820035, 0.2637928426, 0.2700817287, 0.1726486087, -0.1320698112, -0.0085809128, 0.2180731893, -0.1424892247, 0.1053131223, 0.350574255, 0.0558368228, -0.5953502655, -0.1559167653, 0.0195551366, 0.4437176883, -0.1576196998, 0.5006455779, -0.2792440057, -0.2009062469, 0.3072485328, 0.0240257941, 0.7952349782, -0.3570334613, -0.0737249553, 0.1223779395, 0.038015686, 0.1837302893, 0.1191258952, 0.0349601507, -0.2109851688, -0.0451515615, -0.059800759, 0.0279014967, 0.3046396673, 0.07125514, -0.2756307423, 0.4917841256, 0.1518160105, -0.1268105954, 0.0093980273, 0.0813792348, 0.351775825, -0.0840343237, 0.0386384577, -0.0358656198, -0.0800582692, -0.0291142501, -0.0343141444, 0.0512451641, 0.1818654686, -0.1677499563, -0.4614765644, -0.1657684296, -0.2538039386, 0.0696963668, 0.1904786825, 0.0104360199, -0.015554212, 0.1314595342, -0.003509697, 0.0700657442, -0.1248800904, -0.1123266146, 0.0263518933, 0.3060843647, 0.102672413, 0.0255048852, 0.3119351566, 0.1221000478, -0.2198853195, -0.0286989659, -0.3010327518, -0.2245678306, 0.2098784894, 0.1740582287, 0.0645139813, 0.0788519606, 0.0688027889, 0.0294616092, -0.0752451047, -0.2182412446, 0.0113634346, -0.0564785413, -0.0776331201, 0.5352753997, -0.0748244002, -0.4235493839, -0.02090187, 0.4053626955, 0.2002406269, -0.0302873421, 0.1166052595, 0.0365919247, -0.0573126972, -0.1606633812, -0.2089415193, 0.0354488119, -0.2038576305, 0.294454366, 0.0864203125, -0.2173196524, 0.2485119253, 0.1789838821, 0.0880027637, 0.3290331066, -0.193305403, -0.3450645506, -0.4518954456, 0.2483118773, 0.0230609309, 0.1391380727, -0.0045209681, 0.1524775326, -0.031764321, 0.2493466884, -0.197956875, 0.1260658503, -0.113750957, 0.2610042691, -0.0130678741, -0.0183456093, -0.0460457094, -0.0965030193, 0.0362858549, 0.0321508124, -0.255245775, -0.0227031559, 0.0939758345, 0.1423314959, 0.0806936324, -0.1288043708, -0.0636432618, -0.0062540821, -0.0939158201, -0.236337468, 0.2578297257, 0.2937581837, -0.1800922155, 0.1154793426, 0.2336887121, 0.2067109644, 0.1157897264, 0.3178339601, -0.1584947407, 0.0974223167, 0.0603503287, 0.4072881937, 0.0689704642, -0.1501172483, 0.1449743509, 0.0592922568, 0.0115348892, 0.0536511689, 0.2454899997, -0.2691060007, 0.1378959417, -0.0138416328, 0.3978843689, 0.3953822851, -0.0577862486, 0.1139667332, 0.1548534334, 0.047114756, 0.0295293853, -0.0768278316, 0.5202014446, 0.1809114367, 0.1295008659, 0.4198642373, 0.3191752732, -0.1101616025, 0.3200750053, 0.150436908, 0.0289671235, 0.0775549114, 0.2483991235, 0.1680113524, 0.0022479924, 0.2887738943, 0.2247949541, -0.2614193857, -0.1135330051, 0.3078893125, -0.0695220605, 0.528696239, -0.070167847, 0.1286156327, -0.0728627741, -0.6161950231, 0.133554846, 0.0361777842, -0.4510499239, 0.1827566773, 0.0080104433, 0.2531332672, -0.3910346925, -0.3703327179, -0.219566375, 0.4271660149, -0.2437702268, -0.3405458927, -0.1598487347, -0.108289443, -0.0566911511, 0.0873433426, -0.1157143191, 0.1754126102, 0.7584127188, 0.023450302, -0.1393945515, -0.2420700938, -0.3078981936, 0.0167936981, 0.291505754, 0.0562275425, 0.5065606236, -0.062696144, -0.0322499871, -0.1617340297, 0.2836576402, 0.5438067913, 0.6444222331, -0.3587299883, -0.1026915833, 0.1454259306, -0.058843188, -0.1368186772, 0.3955861032, 0.0659537166, 0.3027461469, 0.2671024799, -0.0589364059, 0.0205622632, -0.1275097728, 0.2445563823, 0.243092224, -0.0351936929, 0.308141917, 0.0229521487, -0.0472324789, 0.2128297836, 0.1174852923, -0.3980327845, -0.174776867, 0.4242064953, -0.514904201, 0.2643513381, 0.1827848405, 0.0437714495, 0.0698604137, 0.4881626666, 0.3512014151, 0.1873044074, -0.2638377845, -0.2302781492, -0.4505083263, -0.0517940037, -0.2045982033, 0.2934901118, -0.0522413515, -0.0020608855, -0.0752921402, 0.1396795213, -0.0422466509, -0.3041798174, 0.4681906998, 0.3093081415, -0.5451641679, 0.1230487525, 0.0579696335, -0.1336419731, 0.0283421166, -0.3188732564, 0.289842844, -0.0201223269, -0.144296363, 0.1392997056, 0.1771518439, 0.0797945261, 0.0918296203, -0.0014133069, 0.2944309413, 0.570786953, -0.0234766677, 0.0339961387, -0.2556169629, -0.0185796544, -0.1071839407, 0.0360858887, 0.061274942, 0.4165354073, -0.1944233775, 0.019566834, 0.0290840566, 0.1536454558, 0.1593732238, 0.2374938875, -0.3469750881, 0.1436147839, 0.119390212, 0.0425021239, -0.1771374941, 0.3741259873, 0.1736968905, 0.3392373323, -0.337323457, -0.2500854433, 0.3955120742, -0.0497903712, -0.1436157972, -0.5925132036, 0.1727862656, -0.1346155703, -0.0207737014, -0.5948373079, -0.2907794714, 0.1976026595, -0.2115626037, -0.5768409371, 0.3014440536, -0.0852303654, -0.0988463461, -0.0711720064, -0.0490696393, 0.1106259003, -0.1035623327, 0.2021357417, -0.0847771615 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
It works on my side @timothyjlaurent on google colab. Did you try to uninstall datasets first, before updating it to master's version ?
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
23
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` It works on my side @timothyjlaurent on google colab. Did you try to uninstall datasets first, before updating it to master's version ?
[ -0.4354047179, -0.021331273, -0.0379032679, 0.2603291869, 0.1033043489, -0.052439712, 0.2046662718, 0.3077458441, 0.0026613548, 0.1889888048, 0.0298017263, 0.4250422716, -0.4757447243, 0.3481318057, -0.3869569302, 0.0821055323, 0.0981037691, -0.0260528252, -0.4865830541, 0.2010209113, -0.2182767689, 0.2801357806, -0.3317171335, 0.1242953241, -0.5650151372, 0.1543959826, -0.0827687085, 0.2532313764, -0.0937663317, -0.586969316, 0.34623757, 0.2859279513, 0.0827237293, 0.5430804491, -0.0001225756, 0.1585458517, 0.3996105194, -0.0728133097, -0.1234327331, -0.4519863427, -0.2428455502, -0.2225297689, 0.3537068367, 0.11010129, 0.1572968066, 0.0896836892, -0.0942773819, -0.1369981468, 0.218570888, 0.449801147, 0.116243422, 0.1494445503, 0.2604192197, 0.0649837628, 0.0276058558, 0.070115611, -0.030433435, 0.0448696651, 0.2290813327, -0.3252795935, -0.0746489912, 0.2701991796, -0.1925478578, -0.2442039698, -0.0867798999, -0.2524146438, 0.7048783898, -0.6269381046, 0.2332707942, 0.0296634492, -0.1000971869, -0.0182876997, -0.4334952533, -0.1587344855, -0.2270743996, -0.4209837615, 0.2868670225, 0.0445031263, -0.1510619819, 0.1726668626, -0.5132810473, -0.2258366644, -0.0053111156, -0.0845076442, -0.1335170418, 0.5947372317, 0.1725467741, 0.2310223579, 0.2328881025, 0.0781651661, 0.2869793177, 0.0087678581, -0.1394618005, 0.1362144947, -0.4196228981, 0.064166747, 0.0493195169, -0.0538376831, -0.3091589212, -0.0214068014, -0.1810191125, 0.0600143299, -0.0766370147, 0.092253305, 0.4507500827, -0.1021425575, 0.1322089136, 0.2775730193, 0.2553700805, -0.1338889599, 0.0027396178, 0.0537191257, 0.2788274586, -0.1379815787, -0.0712777451, 0.3527617753, 0.1793914288, -0.2538718581, -0.1571783274, 0.1081766114, -0.1086772159, -0.2043840885, 0.077867575, 0.1800425947, -0.0431440622, 0.740688026, 0.1121359691, 0.1405055672, -0.2476970106, -0.0563074425, -0.078057386, -0.0575002953, -0.4616802335, 0.0806490779, 0.2490377724, -0.1137033477, 0.016910756, 0.0314535946, -0.3257340193, -0.2158709168, 0.0585303381, -0.2257626653, 0.0498761795, 0.6758980155, -0.0760779604, -0.0045042625, -0.0882380679, -0.1388803124, 0.1334870756, 0.2678615451, -0.4715878367, -0.2385821491, -0.2375299484, 0.1271954328, 0.0577777363, 0.2616374791, -0.1870083511, 0.2372547835, 0.4167130888, -0.30553478, -0.3097491562, -0.3427868187, -0.3820719123, -0.2815804482, -0.0010891544, 0.2608673573, -0.4083782732, -0.0015208843, -0.0218612999, -0.2062691301, 0.2619020045, 0.1431882977, 0.0295005888, -0.0487718657, -0.1298928559, -0.0752123147, 0.0204904769, -0.1485111564, -0.1331747919, 0.2066438794, 0.0465194881, 0.2810731828, 0.0063181454, -0.274014473, 0.2846453786, -0.1788804382, 0.2588832676, -0.0733953193, -0.1972065121, 0.0146354288, -0.4012225866, -0.0498289727, -0.1051107645, -0.0243013892, 0.4020920694, 0.2022487968, -0.0971083418, -0.4577626884, 0.3154036701, -0.0619269907, 0.3068204522, 0.0584408715, 0.102167055, 0.0915572047, 0.1256655306, -0.2957904935, -0.4701087177, 0.2083052248, -0.113158226, 0.1168776155, -0.0765491202, 0.0008789108, 0.1114094853, 0.1604783386, -0.1929921955, -0.1629260927, 0.0659719259, 0.0154282004, -0.3101079464, -0.1127226055, -0.2120904773, 0.658310473, 0.0757853165, 0.1861140281, -0.1015598103, 0.1751903743, -0.1800918728, -0.392166853, -0.1826355755, 0.2310133129, -0.0450027436, -0.1228733882, -0.2446096689, 0.4539425373, 0.4125306308, -0.0828957632, -0.0622488223, 0.1302367747, 0.2469467372, -0.1775523722, -0.1807738543, 0.1462675482, -0.0164522547, -0.1234349012, 0.1983513087, 0.4298540652, 0.061175473, 0.4018045962, 0.1947902441, 0.2197563797, 0.2534513175, 0.0414370522, -0.0207240395, -0.2292795926, 0.156795308, -0.0927786827, 0.1558270007, 0.0785806328, -0.0827602744, -0.2234295756, 0.099893488, 0.0262260363, -0.2332392335, 0.0764150992, 0.0616143793, -0.083965838, 0.1554961503, 0.1190403253, 0.3780833483, 0.0167538598, -0.1266406327, 0.2620252073, -0.2395738214, 0.0004299612, 0.1667567343, -0.0738915652, 0.3823560774, 0.2637554407, 0.0877102017, 0.0352478698, -0.1782206893, -0.2680314481, 0.0835175738, 0.4059549868, -0.4702151716, 0.1295323074, -0.3255929053, 0.2863401771, 0.110597685, -0.1536781937, -0.3101345599, -0.5067862868, -0.1523494571, 0.5275386572, -0.0916634202, 0.1440250725, -0.0322290957, 0.0580475368, -0.218020618, 0.3890378475, -0.1477664858, -0.3442545235, -0.2100164741, -0.07254228, 0.4129150212, -0.2999785542, 0.1684941947, 0.0808765143, -0.2183601111, 0.1564548761, -0.297708571, 0.0967226028, -0.1017194018, 0.0640534908, 0.1419490129, -0.113402009, 0.0132326093, -0.1293156743, 0.0996486992, -0.1607406288, -0.2497454286, 0.2247126698, -0.1426774561, 0.0508385599, -0.2256071866, -0.3213130236, -0.4195496142, -0.1224397197, -0.1029028147, -0.1816917807, 0.3723811209, 0.1235637739, 0.004152698, -0.0326517634, -0.0467815399, 0.0780998766, -0.051718656, -0.14820081, -0.1875607669, -0.0115971062, -0.1723947376, 0.0447335504, 0.0954322219, 0.1488696933, 0.352150321, -0.3665967286, 0.0323756598, 0.0986392871, -0.1541324109, 0.18215774, -0.1341318339, 0.2472575456, 0.427238524, 0.0512183905, -0.0059533413, -0.2139766514, 0.0332702734, 0.0367044024, 0.0944871232, 0.026959585, 0.3396879733, 0.1084800139, 0.6143610477, 0.3531056643, 0.0673899129, 0.3380682766, -0.0831015185, 0.1371387988, -0.1871894002, -0.4327065945, -0.1445244849, -0.3046979606, -0.0695493892, -0.1678985506, -0.1297107786, -0.3863488734, -0.3299004734, 0.5365659595, -0.3019443452, -0.2281482369, -0.0869772956, -0.4763881862, 0.2397382855, -0.0459845178, 0.0330856815, -0.016061632, -0.0340640321, -0.2282368988, 0.2794629335, 0.0463744104, -0.2925069034, -0.2189248502, -0.3621685207, -0.4394076169, 0.306959182, 0.1948436946, 0.6096240878, 0.0758862719, 0.0055938545, 0.0157366637, -0.1097050309, 0.8984597921, -0.5756092668, -0.3717857301, 0.2971129715, -0.4429658353, -0.1966266334, -0.2272344679, -0.1986097395, 0.5277138948, 0.3542860746, 0.3339731693, -0.081263423, -0.3351704478, 0.2341609448, -0.1970133036, -0.101908356, -0.0012264674, -0.3534617126, 0.0383472368, -0.1581905782, 0.0760401413, -0.3219119906, 0.1301033199, -0.2366093695, -0.1010331586, -0.0990144238, -0.1143913642, 0.2294452339, 0.1132526025, -0.007077849, -0.1349931806, 0.0776520967, -0.0002368226, 0.203814894, 0.3503991663, 0.3510706425, -0.4083854854, -0.1374307573, 0.2050531507, 0.0272700563, 0.3153604269, 0.2631453574, 0.2029476315, -0.1187973097, 0.0076832646, 0.1836528331, -0.2178967893, 0.0136351036, 0.3250059783, -0.0021273703, -0.6167441607, -0.1871481985, -0.0275552832, 0.4484912753, -0.1468027234, 0.4348124862, -0.3938327134, -0.3060361743, 0.3708011508, 0.122089386, 0.7906639576, -0.38415277, -0.0390993617, 0.0074554798, -0.0294350218, 0.1756474674, 0.0881976783, 0.0723473653, -0.3037419915, -0.0416939445, -0.0644234642, 0.1050785705, 0.2288896143, 0.126217097, -0.2223205715, 0.4922862351, 0.0313613787, -0.0393868089, 0.0081441849, 0.1416223943, 0.38278386, -0.057526309, 0.1069020852, 0.0146027599, 0.0199214518, -0.1362493932, -0.0200801976, -0.0057204096, 0.2628921866, -0.0662715957, -0.3939189911, -0.0826956481, -0.2232791632, 0.1065089107, 0.1593916416, 0.0691582114, 0.0179591924, -0.0173599143, -0.0089867515, 0.0875473097, -0.0935939923, -0.1216053069, 0.0640571341, 0.3566726744, 0.1275509298, 0.076957725, 0.3548256159, 0.0887994096, -0.2294702083, 0.0196583066, -0.2300753891, -0.2295106798, 0.0692363828, 0.0351720378, -0.0158812907, 0.136273399, 0.0685124844, -0.0160010718, -0.1341084391, -0.1983486414, 0.0759319663, -0.0742572173, -0.1341285408, 0.4565621316, -0.0208652504, -0.4040486217, -0.0150764454, 0.4753893316, 0.2630130649, -0.0304919612, 0.1754942983, 0.1332139075, 0.0530629531, -0.2314902246, -0.1961838305, 0.2538499534, -0.1257032603, 0.3030162752, 0.0551355518, -0.2737411261, 0.3017932177, 0.100464806, 0.1316057742, 0.4018435776, -0.2024607956, -0.3165369034, -0.5207991004, 0.2257960141, 0.0114975618, 0.0770635009, -0.1637188494, 0.2023658603, -0.0716059357, 0.2509379387, -0.2399386913, 0.1434380412, -0.1084157228, 0.1871654391, -0.0967848822, 0.0084109586, -0.1806608289, -0.1770702451, 0.0653354824, 0.0199865885, -0.2602193058, -0.0486227013, 0.0486738123, 0.1250516325, 0.1307236254, -0.1203112006, -0.102401711, -0.0336567089, -0.137715742, -0.1636200845, 0.2318588197, 0.2656702399, -0.1671268493, 0.1718910486, 0.1938102841, 0.0712788478, 0.0635037869, 0.3051728606, -0.1433325708, -0.0388203226, 0.0464690514, 0.4356118739, 0.1066292673, -0.1829194278, 0.0858232379, 0.0566575713, -0.1773483604, 0.0550206415, 0.2996479273, -0.2549986541, 0.0197279956, 0.0032343031, 0.4577388763, 0.449619621, -0.028676806, 0.0523706712, 0.1740734577, 0.1175027415, -0.0192274414, -0.0907895938, 0.4671582878, 0.1339298785, 0.0730501339, 0.2822966278, 0.2857061028, -0.1302192658, 0.1707004905, 0.2068177313, -0.1275931746, 0.0618725941, 0.2945268452, 0.304564178, 0.1483751535, 0.2929368913, 0.234431833, -0.2614423633, -0.1006950811, 0.4330563545, -0.0023196961, 0.6118904352, 0.0232094899, 0.0663694963, -0.0421512462, -0.5977564454, 0.1128705591, 0.1524530947, -0.4710718095, 0.1441168636, -0.0279059913, 0.2607675195, -0.3617390394, -0.5522367358, -0.2278291136, 0.3568049669, -0.2619926333, -0.3144665658, -0.2318209559, -0.1654920429, -0.1205217764, 0.0910987332, -0.1149415672, 0.1981252879, 0.7187824845, 0.0533018, -0.0966017023, -0.203271687, -0.4901352823, 0.0202736314, 0.2725246549, 0.0038026378, 0.385862112, 0.0100092078, -0.044827424, -0.0597183593, 0.2000954002, 0.4813219607, 0.7049610019, -0.4624644518, -0.0323621444, 0.170108065, -0.0370742194, -0.0712413862, 0.3653138578, 0.1443499178, 0.237088263, 0.2170631289, -0.0534212552, 0.0103764264, -0.0988130718, 0.2725340426, 0.2391125262, -0.0500677116, 0.3155851364, 0.1682042181, -0.0819733366, 0.2457943857, 0.107054323, -0.3547038734, -0.2583479583, 0.5720748901, -0.4759394825, 0.2169441581, 0.1774107367, 0.0621651188, 0.0866574496, 0.5702397823, 0.3672221005, 0.1261857897, -0.2507761121, -0.2363354564, -0.4916423857, 0.0022978329, -0.1355819702, 0.3526294529, 0.0493119359, -0.0417461433, -0.0722351447, 0.0806350783, -0.0273707826, -0.1785650402, 0.3432694376, 0.316331923, -0.5723838806, 0.184589833, 0.0346430503, -0.0773485154, -0.002817011, -0.2534408569, 0.3371373713, -0.0350742787, -0.1019872949, 0.1381354034, 0.1860684752, 0.1227264628, 0.1683129966, 0.0822113231, 0.2360452414, 0.5106272697, 0.0284206234, 0.0158380438, -0.3051036, 0.0315126702, -0.1612470448, -0.0157733839, 0.0998518765, 0.4244031906, -0.1579048932, 0.0052359556, -0.0106179751, 0.2532092631, 0.0556076206, 0.2211030126, -0.4375543892, 0.2328781933, 0.2318996936, 0.0851718187, -0.1381648034, 0.4167881608, 0.1708543897, 0.3439677954, -0.3627953529, -0.2012808025, 0.3263410628, -0.0431997292, -0.1527231634, -0.6441501379, 0.1936711669, -0.1285033077, 0.0245877542, -0.5834946036, -0.2899975479, 0.1339088082, -0.1852586567, -0.5932968855, 0.2438428998, -0.0322689787, -0.0596763901, -0.0747538507, -0.2190404683, 0.136681512, -0.1838208884, 0.1465087533, -0.0944245979 ]
https://github.com/huggingface/datasets/issues/620
map/filter multiprocessing raises errors and corrupts datasets
I didn't -- it was a new sessions --- buuut - look like it's working today -- woot! I'll close this issue. Thanks @lhoestq
After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ```
24
map/filter multiprocessing raises errors and corrupts datasets After upgrading to the 1.0 started seeing errors in my data loading script after enabling multiprocessing. ```python ... ner_ds_dict = ner_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) ner_ds_dict["validation"] = ner_ds_dict["test"] rel_ds_dict = rel_ds.train_test_split(test_size=test_pct, shuffle=True, seed=seed) rel_ds_dict["validation"] = rel_ds_dict["test"] return ner_ds_dict, rel_ds_dict ``` The first train_test_split, `ner_ds`/`ner_ds_dict`, returns a `train` and `test` split that are iterable. The second, `rel_ds`/`rel_ds_dict` in this case, returns a Dataset dict that has rows but if selected from or sliced into into returns an empty dictionary. eg `rel_ds_dict['train'][0] == {}` and `rel_ds_dict['train'][0:100] == {}`. Ok I think I know the problem -- the rel_ds was mapped though a mapper with `num_proc=12`. If I remove `num_proc`. The dataset loads. I also see errors with other map and filter functions when `num_proc` is set. ``` Done writing 67 indices in 536 bytes . Done writing 67 indices in 536 bytes . Fatal Python error: PyCOND_WAIT(gil_cond) failed ``` I didn't -- it was a new sessions --- buuut - look like it's working today -- woot! I'll close this issue. Thanks @lhoestq
[ -0.4389112592, -0.1553173959, -0.0303597879, 0.2238799483, 0.1435325593, -0.1580420583, 0.3082617819, 0.3411380947, 0.1361239702, 0.1270736009, 0.0647981912, 0.3830270767, -0.431142509, 0.3586109281, -0.3158304393, 0.0192880966, 0.1044041067, -0.0822965726, -0.372672081, 0.2437450737, -0.2811784744, 0.2419260889, -0.3431833982, 0.1499836743, -0.5202985406, 0.091508396, -0.0610797778, 0.2870168984, 0.0001861896, -0.5671349168, 0.3406104445, 0.2375902832, 0.0439227186, 0.433978796, -0.0001241726, 0.1413951814, 0.3641112149, -0.1141221598, -0.069016777, -0.3426638544, -0.2272139043, -0.2039407492, 0.2903554738, 0.1174307987, 0.1919282079, 0.0396894552, -0.1186007112, -0.2761326432, 0.2109069675, 0.4283507168, 0.1021493375, 0.2034934461, 0.2628211975, 0.1077970117, 0.0287279319, 0.1473949701, -0.035130538, 0.0102035766, 0.3186470568, -0.3860553801, -0.0874853656, 0.2630181313, -0.2542264163, -0.1928122193, -0.1764390022, -0.2241110653, 0.6580690145, -0.5945963264, 0.1860852689, 0.057021074, -0.1738320589, -0.0090259742, -0.438234657, -0.1861440241, -0.2577211261, -0.5019297004, 0.2167699039, 0.0640544593, -0.1605041474, 0.1461488456, -0.4861243665, -0.216223672, -0.0459570847, -0.0600845106, -0.0794195756, 0.526899159, 0.2126139849, 0.3030979037, 0.1667359769, 0.1282709539, 0.200357452, 0.0367890783, -0.1074386835, 0.1688028425, -0.4264655113, 0.0932107717, 0.1012028977, -0.046935834, -0.2404869497, 0.0284213573, -0.1960729361, 0.091213353, -0.0908491462, 0.044377964, 0.4214398563, -0.1040274799, 0.2137224227, 0.2978258729, 0.2598981559, -0.2024500668, 0.0061801034, 0.0403157957, 0.3496517539, -0.1308580041, -0.0845073536, 0.3169028759, 0.1554717571, -0.1958628744, -0.177835837, 0.1278185546, -0.0874685496, -0.2110479474, 0.0750091001, 0.193967998, 0.0216420516, 0.775827229, 0.1422024816, 0.1933227479, -0.325258106, -0.1087511331, -0.075679861, -0.0402469933, -0.3965355754, 0.0837787166, 0.2747551799, 0.0335658193, -0.0190133024, 0.0139805321, -0.38548702, -0.2746289074, 0.1181663945, -0.2540864348, 0.1059903428, 0.6713734269, -0.0934601948, 0.0071928217, -0.0351632014, -0.1314367056, 0.0976829231, 0.2614504397, -0.5445337892, -0.2043902427, -0.2256695628, 0.0868669972, 0.0191379283, 0.2917739451, -0.1509464979, 0.2350898832, 0.4053872228, -0.3626492321, -0.3123523593, -0.3348921537, -0.3482547104, -0.2950327396, -0.0426827967, 0.2990986109, -0.3928129673, -0.0415191837, 0.0763777271, -0.2192997336, 0.3062732816, 0.2014251053, -0.0193770994, -0.0061094174, -0.1035310701, 0.0675834343, 0.0663000196, -0.2072346359, -0.1084176078, 0.2526923716, 0.0651987493, 0.3254319131, -0.0205415338, -0.2612630129, 0.3218257129, -0.164181307, 0.24079521, -0.0771472305, -0.1891907901, 0.0664505661, -0.4434908926, -0.0198264048, -0.0087881805, -0.0699772686, 0.3942249119, 0.1964439452, -0.1109890342, -0.496375829, 0.3344273269, -0.1099408492, 0.3142295778, 0.0408366136, 0.0857007429, 0.069818534, 0.1444448084, -0.2950137556, -0.4820037186, 0.1784678549, -0.2608715296, 0.0483102202, -0.0037989747, 0.0216593537, 0.0957437158, 0.1924473792, -0.1963995248, -0.204377979, 0.0327276886, -0.0337021425, -0.3150818944, -0.0680288598, -0.2182212174, 0.6899921894, 0.1175845489, 0.1319133788, -0.1111833304, 0.2003581673, -0.1506474614, -0.4101494253, -0.2707152963, 0.2542413175, -0.0004457652, -0.067837812, -0.1897203773, 0.4699811935, 0.478674233, -0.1128504723, -0.0575906709, 0.1334886104, 0.2497291863, -0.1686915159, -0.1394182146, 0.0356439613, 0.0225015879, -0.1713115871, 0.2028629035, 0.4330973029, 0.1223600805, 0.4227697849, 0.2035805881, 0.2512251139, 0.2895071208, -0.003304621, -0.0225609187, -0.1272282153, 0.213368088, -0.1696628481, 0.139985621, 0.0221166797, -0.1458355039, -0.239418745, 0.0672905073, 0.0190609824, -0.1369376928, 0.0566277429, 0.0696794689, -0.0945379958, 0.1550382525, 0.0438799635, 0.4365884662, 0.0082248868, -0.208840996, 0.1739031225, -0.2554394305, -0.0099013606, 0.1101606637, -0.0709502101, 0.4103221893, 0.2982473075, 0.0862268433, 0.0025430375, -0.1559939235, -0.3185815513, 0.0706309378, 0.3644182384, -0.5294399858, 0.1767974943, -0.2681468129, 0.3429840505, 0.1035523862, -0.1245051697, -0.2846293151, -0.5637059212, -0.1075892448, 0.5049536824, -0.0873983949, 0.1322870106, -0.081023261, 0.087884523, -0.2123986632, 0.3743553758, -0.1540358365, -0.3298155963, -0.1779155582, -0.0936024189, 0.3544712663, -0.2819010317, 0.2225760967, 0.1541032344, -0.2573420107, 0.1878949255, -0.3045695722, 0.0626313314, -0.0436366536, 0.0536769405, 0.1156658232, -0.0004304348, 0.0411714539, -0.1813838929, 0.1464890689, -0.1574027538, -0.2222721726, 0.2964484096, -0.1393524855, 0.0939633995, -0.2634341121, -0.3453350663, -0.4375618398, -0.1150625423, -0.0753437579, -0.1841028333, 0.340344429, 0.1291126609, 0.0309453066, -0.0299717654, -0.0697866231, 0.0478993095, -0.0658788458, -0.059398856, -0.2077104598, 0.0360212885, -0.1212214679, -0.0526948683, 0.0805643946, 0.1198309064, 0.4075065851, -0.3314507306, 0.0480157994, 0.0899492726, -0.1362225413, 0.219660759, -0.1817480177, 0.346920222, 0.41041255, 0.0584699586, -0.0340176895, -0.1860706508, 0.0954234079, 0.0386620648, 0.0524461456, 0.0951315388, 0.3037010133, 0.1426619291, 0.547745347, 0.3771878481, 0.103832528, 0.3844012618, -0.0821645111, 0.1198284999, -0.2023443878, -0.3933932781, -0.1818886995, -0.3160485625, -0.0118764518, -0.2425552756, -0.092724286, -0.4461112022, -0.3504074514, 0.5543602109, -0.3758941889, -0.2395124584, -0.0468254089, -0.521350801, 0.2646474838, -0.0838060305, 0.0509239659, -0.0283502825, -0.0298486073, -0.2563855648, 0.1997664869, 0.1217580289, -0.3251346052, -0.2877397239, -0.2596100867, -0.4335172772, 0.3148643076, 0.2012098134, 0.6812642813, 0.0003931381, -0.0801635906, 0.0085697351, -0.1337455213, 0.8955230713, -0.6052265763, -0.3748028576, 0.3144158125, -0.3783259988, -0.2645666599, -0.1625884324, -0.1791367084, 0.5422024727, 0.3443923593, 0.3918619752, -0.1067364514, -0.2833139896, 0.2422165573, -0.2013669759, -0.1008807048, 0.0209744088, -0.3194947243, -0.0250377022, -0.1747473031, 0.0378719717, -0.2602267563, 0.083942987, -0.2379896641, -0.0681497604, -0.1017655656, -0.0635965392, 0.255874753, 0.05165888, -0.0036194718, -0.2103955895, 0.0366049856, 0.0464492962, 0.1680697799, 0.2738559246, 0.277892828, -0.4287842512, -0.1004447341, 0.1635331064, -0.0033508909, 0.3238943517, 0.2844069302, 0.2353750616, -0.123385191, 0.0471063741, 0.1985633969, -0.294303298, -0.007224591, 0.3591531813, -0.0389200523, -0.5711477399, -0.1325410455, -0.0589141063, 0.4101541042, -0.1745318174, 0.5028032064, -0.4040951729, -0.2674125731, 0.3955000639, 0.0618787967, 0.7986560464, -0.3684015572, -0.0315077119, 0.0784258395, 0.0157470852, 0.0965812057, 0.0716536716, 0.0351689309, -0.2841925025, 0.002769242, -0.0598041378, 0.0394074619, 0.3132290542, 0.1772976965, -0.1591723114, 0.4332929254, -0.0048883413, -0.0966080129, -0.0331121944, 0.1443442851, 0.4444707036, -0.0378573239, 0.0888577402, -0.0030983572, -0.0598700382, -0.1694537103, 0.0205883849, 0.0446935259, 0.2799757719, -0.1480808407, -0.4104651511, -0.0688648596, -0.1108006686, 0.1305981725, 0.2134428918, 0.1203013137, -0.0266280249, 0.1129794791, -0.1301921755, 0.0459450111, -0.0973097831, -0.1229395121, 0.0945900753, 0.354736656, 0.2294874787, 0.0524014346, 0.3715539277, 0.0996860713, -0.2941741645, 0.0591277443, -0.2497491539, -0.2445218563, 0.0230629276, 0.0745783001, 0.0911558121, 0.0852726921, 0.1139178574, -0.0113201886, -0.1307720393, -0.1835197806, 0.0477007627, -0.0449271873, -0.1178247556, 0.5261172056, -0.049987223, -0.3697991073, -0.0020986097, 0.4567426145, 0.23050946, -0.1154205427, 0.1137659252, 0.1260137856, -0.0325600393, -0.2368056327, -0.1776185334, 0.229618907, -0.1732086539, 0.2777262926, 0.0771604404, -0.2246047854, 0.2320954949, 0.0277600084, 0.0488729067, 0.3711373806, -0.1884257793, -0.3409453332, -0.4504370391, 0.2851999402, 0.0569392405, 0.0860523507, -0.1097670719, 0.1406215131, -0.0625021681, 0.2860082388, -0.2217985392, 0.1086063683, -0.0434019007, 0.2306846827, -0.081115365, 0.0209751539, -0.1002750769, -0.1217832193, 0.0783500224, -0.016135307, -0.2222100794, -0.0299738497, 0.0373682082, 0.1364162117, 0.0792153552, -0.2170053571, -0.0580645502, -0.0694184229, -0.1116665602, -0.1975591183, 0.1700116098, 0.3778552711, -0.2157562524, 0.1627099514, 0.2334393263, 0.1576208174, 0.1360865384, 0.336720854, -0.2189628631, 0.0361103006, 0.0200929958, 0.4062176943, 0.1348040849, -0.1911144257, 0.048033718, 0.1183555499, -0.0878906175, 0.0132841002, 0.3321458995, -0.2417397499, 0.0466572493, 0.0027653505, 0.4242885113, 0.403999567, -0.1242795736, 0.1138939112, 0.128414765, 0.0989410356, 0.0134859262, -0.1570080072, 0.5547400713, 0.1114387661, 0.0611253418, 0.3319326639, 0.2720371485, -0.1747556031, 0.2071678787, 0.1542919725, -0.0786117986, -0.0768165737, 0.2549142241, 0.1522732526, 0.0538587049, 0.2410253137, 0.1996327043, -0.3166678846, -0.1305837184, 0.3212501407, 0.0100676734, 0.4989770651, -0.0399584286, 0.1095739007, -0.1257618368, -0.6536566019, 0.0496180765, 0.1127596423, -0.5217784047, 0.2226066291, -0.0324491449, 0.2831968367, -0.3367136717, -0.449846983, -0.1828361452, 0.3819919229, -0.2711340785, -0.3221406639, -0.2267080545, -0.1483098865, -0.0997902751, 0.0662750304, -0.1178689376, 0.1854427457, 0.801915288, 0.0322908834, -0.0746421069, -0.1906514615, -0.3439490497, -0.0163976941, 0.3141085804, -0.0198103152, 0.4053680599, 0.0181749109, 0.0303026699, -0.0187588353, 0.1585476398, 0.4757376015, 0.7030797005, -0.4632852674, -0.0224412512, 0.1462651193, -0.0747060776, -0.0866849497, 0.4076161385, 0.126225844, 0.3313068449, 0.2883496881, -0.0535501055, 0.0369686633, -0.1178284064, 0.3061882854, 0.3639976084, 0.0329929553, 0.344456166, 0.0636600778, -0.1106197685, 0.2326204628, 0.0831907168, -0.3255212605, -0.306191653, 0.517018199, -0.4688681662, 0.2489013523, 0.1927308142, 0.0471718758, 0.1036802679, 0.4653494954, 0.2887440622, 0.1077414379, -0.287296772, -0.167834878, -0.4076785445, -0.0197941326, -0.1969341487, 0.3094288409, -0.0087308818, 0.0166616309, -0.0470238291, 0.0472434536, -0.0202061851, -0.2586670816, 0.3506317139, 0.2956223488, -0.5638791919, 0.1922886819, 0.0746316016, 0.0110437302, 0.0230900701, -0.3029469848, 0.3537075818, 0.017216444, -0.1114220321, 0.1150783598, 0.145323053, 0.1238250285, 0.1865614057, 0.009580696, 0.2730885148, 0.5970848799, -0.0058609974, 0.008170058, -0.2979803085, 0.0210411828, -0.09248887, -0.0315572843, 0.0570214279, 0.4098128974, -0.2148820013, -0.0458693281, 0.0307063963, 0.1876496226, 0.0146620935, 0.2140070498, -0.4316043854, 0.1968338788, 0.2346982807, 0.0222955104, -0.150883168, 0.3642426431, 0.1588979959, 0.3398590386, -0.2817395329, -0.1986921281, 0.2920215428, -0.0160550289, -0.1066012383, -0.6062430739, 0.2379885316, -0.1984822154, 0.1442449391, -0.5549510717, -0.3425118923, 0.1964057833, -0.1812262833, -0.5432785749, 0.2515479028, -0.1097089052, -0.1704102457, -0.0524097793, -0.2285162657, 0.1160427183, -0.1258506626, 0.1942719668, -0.0692154393 ]
https://github.com/huggingface/datasets/issues/619
Mistakes in MLQA features names
Indeed you're right ! Thanks for reporting that Could you open a PR to fix the features names ?
I think the following features in MLQA shouldn't be named the way they are: 1. `questions` (should be `question`) 2. `ids` (should be `id`) 3. `start` (should be `answer_start`) The reasons I'm suggesting these features be renamed are: * To make them consistent with other QA datasets like SQuAD, XQuAD, TyDiQA etc. and hence make it easier to concatenate multiple QA datasets. * The features names are not the same as the ones provided in the original MLQA datasets (it uses the names I suggested). I know these columns can be renamed using using `Dataset.rename_column_`, `questions` and `ids` can be easily renamed but `start` on the other hand is annoying to rename since it's nested inside the feature `answers`.
19
Mistakes in MLQA features names I think the following features in MLQA shouldn't be named the way they are: 1. `questions` (should be `question`) 2. `ids` (should be `id`) 3. `start` (should be `answer_start`) The reasons I'm suggesting these features be renamed are: * To make them consistent with other QA datasets like SQuAD, XQuAD, TyDiQA etc. and hence make it easier to concatenate multiple QA datasets. * The features names are not the same as the ones provided in the original MLQA datasets (it uses the names I suggested). I know these columns can be renamed using using `Dataset.rename_column_`, `questions` and `ids` can be easily renamed but `start` on the other hand is annoying to rename since it's nested inside the feature `answers`. Indeed you're right ! Thanks for reporting that Could you open a PR to fix the features names ?
[ 0.2796131074, -0.0672782585, -0.0831843615, 0.1901167333, 0.2244755477, 0.3354705274, 0.5049107671, 0.1621007472, -0.2027409226, -0.0173159614, 0.1145084947, 0.1897463799, 0.3583107293, 0.4374579489, -0.0695422962, -0.2454163581, 0.24638547, -0.0470876172, 0.2421890348, -0.0504074432, -0.2164764702, 0.2113193125, -0.09553314, 0.6324015856, 0.0162045788, 0.0617664121, -0.0821972117, 0.0513547771, 0.1023245007, -0.2556810677, -0.3580749929, 0.0417947806, -0.1288837045, 0.0629306734, -0.000112155, -0.502758801, 0.3252595067, -0.0481606759, 0.0559791066, 0.1959296763, -0.4208877385, -0.4244924486, 0.0467999913, -0.3844262362, 0.2206072211, -0.2236409187, -0.2441879809, -0.1287856847, -0.1785167158, 0.1382636428, 0.2021540701, -0.0150759974, 0.2414555401, 0.0380665436, 0.1567501128, -0.021693727, -0.2375082374, 0.0635239333, 0.1898537427, -0.3023801446, 0.3947694302, 0.4994891286, -0.2198393494, 0.161597088, 0.2153594643, 0.1484520137, 0.4425869882, -0.4972688556, 0.2903123498, 0.2118742317, 0.3128451407, -0.1872742027, -0.2283303738, -0.24884592, 0.1180138513, -0.4643639922, 0.1259204596, 0.1799847782, 0.0420381203, -0.2551813126, 0.0971522406, -0.2348625213, 0.2476615459, -0.0904304162, -0.1196247414, -0.1861041933, 0.0913870633, 0.1037456915, -0.2814543843, -0.3552182615, 0.3920390606, 0.1443682015, -0.1899145097, -0.070931986, -0.449195832, -0.1471945196, -0.0656532049, 0.1372911781, -0.1833674461, -0.0760087296, -0.2866714895, -0.1546824127, 0.2513922453, -0.0729938522, -0.1349552572, 0.2213106304, 0.2043882459, -0.1287402213, 0.2029763758, -0.008878869, -0.1400404423, -0.0656037927, 0.0924019814, -0.0184068754, -0.4182294905, 0.2236416191, 0.1739640534, -0.2739313245, -0.318123132, 0.307644695, -0.447735548, -0.1837327778, -0.1012839228, 0.1104021892, 0.0584750399, 0.1314391047, -0.0421452858, -0.0141475117, -0.1282829791, -0.2364765108, -0.0169015862, -0.0350201428, -0.2116490304, 0.28882128, -0.1696247458, 0.3123839796, 0.2091036886, -0.3090598583, 0.0306377411, 0.0261928923, 0.1595196724, 0.2442903221, -0.1613459289, 0.127141133, -0.1375319809, 0.0108514754, 0.0778981894, 0.0282534081, -0.0115863634, 0.154052034, -0.4452199042, -0.0020242636, -0.3583759069, 0.2011043578, 0.2075181603, 0.0912623852, 0.5391232967, 0.3284411132, 0.2340391129, -0.1146792397, 0.1014700681, 0.0638986751, 0.421046555, -0.0761173442, -0.0373544954, 0.3379051983, -0.2224427462, -0.2421079725, -0.2108465433, 0.2244682312, 0.0717411116, 0.2689328194, 0.1512114257, -0.2363494635, -0.0420140997, 0.1127993241, -0.063427344, -0.1214622632, 0.0940465704, -0.0091807283, 0.0562503412, -0.4241338968, 0.1855675131, -0.083903566, -0.259844929, -0.1348485202, 0.0801541358, -0.0857668221, -0.1918996722, -0.0042833001, -0.2674152851, -0.393406868, 0.2177093476, -0.0340570211, -0.1972795725, 0.2775909007, -0.1092590392, -0.3722411394, 0.0812074542, 0.0164587516, -0.2207567394, -0.2087623477, 0.2250333428, -0.0180337485, 0.1622037441, 0.1617987752, -0.4457290769, -0.2008741796, -0.4516764879, 0.026748063, 0.1582196206, -0.088587001, -0.1440155059, -0.0856713578, 0.1257942766, 0.0197069012, 0.1156931892, 0.1000401974, -0.3079136014, -0.0546974577, -0.2999895513, -0.0695869699, 0.0166511349, 0.0884377733, -0.2995299995, 0.0845689774, 0.0067742551, 0.0245156419, 0.0497615226, 0.3868397772, 0.2614255548, 0.2171544433, -0.1582842916, 0.2827340961, -0.1130651385, 0.1268771589, 0.2862362564, 0.3946854174, 0.1731520891, 0.011411651, 0.1446136087, 0.1174111888, -0.0964711532, 0.2288684994, -0.1158270091, 0.2167549431, 0.082908459, 0.2774332166, 0.0137832239, 0.3125979006, -0.0607787147, -0.3890329897, -0.1617793441, -0.2932704389, 0.2806169689, 0.12194103, -0.2302554101, 0.0286682043, -0.4353845417, 0.3081435859, 0.4657303095, 0.008617701, -0.0998735279, -0.1286445409, -0.0286654718, 0.0195423625, 0.3403355777, -0.1338490397, 0.2067209333, -0.0138758877, -0.3927891552, 0.0305581354, 0.280120343, -0.1702565253, 0.1206269115, 0.3795161545, -0.4961914122, -0.0308023077, 0.3995105028, -0.1206595525, -0.1075788364, 0.2712964118, 0.3922180831, -0.1185783893, -0.3020518124, 0.1671589613, -0.0590962954, -0.4547241032, 0.0114505496, -0.4382166564, -0.2242619395, -0.3971211016, 0.2313412726, -0.1345758736, -0.1287674308, 0.4221913218, 0.3064454794, 0.3904314637, -0.1393620223, 0.5181223154, -0.2536641061, -0.0292950608, -0.0275444183, 0.0332499519, -0.0914423913, 0.240050599, 0.1717611104, -0.0654343218, -0.0571086518, -0.4989719093, -0.4638468623, 0.1367674619, -0.1452697515, 0.5637741089, -0.0681430846, -0.2483800501, -0.1504257023, -0.227866143, 0.1815305948, 0.4881226122, 0.0109626288, -0.0555699989, -0.0401342399, -0.0752227083, -0.1130445749, -0.4911835194, -0.1803045869, -0.1180186048, 0.1634391546, -0.1793168932, 0.1086949855, -0.0388179161, -0.6115884185, -0.2516984344, 0.0535068288, -0.1561783701, -0.3134726882, 0.0295977741, 0.169638291, -0.2660051882, -0.0662301481, -0.0142086307, 0.114947997, 0.0425463021, -0.4492482245, -0.2512800097, -0.440127939, -0.0633308738, 0.1214749515, 0.3817399442, -0.0488701835, 0.0095458422, 0.2082291842, -0.0724831149, 0.1266064048, -0.4921840131, 0.0524867252, 0.5331344008, 0.6120026708, -0.0265212525, 0.4932021201, -0.3559101224, 0.3424316943, 0.0715394244, 0.3521506488, 0.0787939653, 0.0839560181, -0.2783086002, -0.0198827405, -0.2667331398, 0.4488636553, -0.0902372971, -0.1634918302, 0.1174074784, -0.1591564566, -0.0831243992, -0.1478431523, 0.6585758924, 0.0095525747, -0.1561869085, -0.3136456907, -0.5466179252, 0.531301856, 0.1734662354, 0.2710707486, -0.1492186338, -0.1392341256, 0.3164741099, 0.0836727619, 0.2949907482, -0.1113813668, -1.01612854, -0.6102488637, -0.1619787365, 0.2193024009, -0.1704929322, 0.3395326436, -0.0004179199, -0.157708019, 0.0694309846, 0.2542560995, 0.374111414, 0.0146669513, -0.5943672657, 0.4133256376, 0.4034893215, 0.3657947183, -0.4275997579, 0.0984598547, 0.3059117794, 0.0403931998, 0.0077425288, -0.3111067712, -0.1033150926, 0.1952512264, 0.0858673975, -0.4044756889, -0.0101799909, -0.2013162524, 0.0033733242, -0.2211665213, -0.1750168204, -0.227052018, 0.0023750344, -0.1999279559, 0.0937113911, 0.1762762815, -0.1498914063, 0.2022973001, 0.5323473215, 0.2188073844, 0.043012578, 0.3364472985, -0.0893384591, 0.1986300945, -0.1301903278, 0.1045793742, -0.1586585045, -0.4007583559, 0.1648657769, -0.4002196193, 0.44792068, -0.0035477402, -0.0747102723, 0.3443922102, -0.1640865952, 0.2891589403, -0.0436086133, -0.1024337932, 0.403968811, 0.092099227, -0.0113360398, -0.2493541837, 0.3904542625, -0.128146261, -0.1608404368, -0.0669840276, 0.1257349849, 0.0692487285, 0.2802543044, 0.09648031, 0.8481326699, 0.0873075128, -0.3693994284, -0.0362950154, -0.0430644974, 0.3490491509, 0.2155731171, 0.1329014748, -0.2732765079, -0.2228891253, 0.1439791918, 0.0114854183, 0.0663692653, -0.0088115074, -0.0859189555, 0.4378458858, -0.2496570647, -0.1334148794, 0.0046631144, -0.1519678384, 0.3291782141, -0.0919128284, -0.1032709405, 0.0013037494, -0.0551787987, 0.0320166163, 0.067365393, 0.0134254573, 0.1532140225, 0.2280712724, 0.0703624338, -0.2106653154, -0.143459022, -0.2633118927, 0.2165816724, -0.424027741, -0.0710137784, 0.1545516551, 0.5141528845, 0.1313969642, -0.2693910897, 0.1191044003, 0.4850043058, 0.1883933842, 0.0794617981, 0.0329508297, -0.0805015117, -0.065836288, 0.087291792, 0.3662011325, 0.1003157869, 0.1588847935, -0.8413516879, -0.0958493277, 0.437079519, 0.0240395255, 0.0303877275, -0.1506913453, 0.1995594352, -0.20230259, 0.1225019023, -0.0251037274, 0.0037181959, 0.22756356, -0.1892839521, 0.0803500861, -0.0721302181, -0.1647093445, 0.0514402203, 0.0719819814, 0.3237184882, 0.2217675894, -0.0306720734, -0.0739219263, -0.0580768734, -0.2502267063, -0.1972159892, 0.0762856528, 0.1585501134, -0.475689292, -0.1611998677, 0.2974227965, -0.0639711469, 0.278719306, 0.0751363784, -0.2167113721, -0.2680914402, 0.3928011656, -0.0263237283, -0.1625746191, -0.0601110794, 0.1347090602, -0.3619490564, 0.1015699133, -0.2566002309, 0.1478845626, -0.2383136898, 0.114725545, -0.0440851897, -0.1134201139, -0.1752564311, 0.0167190731, 0.0728173405, -0.2535341382, 0.1008441225, -0.0949608088, 0.0469543003, 0.1583999842, 0.0966843069, -0.021042373, -0.0975233614, -0.2031390071, 0.0063377335, -0.0154472906, -0.0230279528, -0.0880548283, 0.1500523239, 0.3062992692, -0.2276081294, -0.1806186736, -0.0943461955, 0.2853699923, 0.3514632583, -0.1775411218, 0.2365430295, 0.1413548887, -0.186892122, 0.1068338379, -0.0975226387, 0.1227636859, -0.3421075046, 0.0746162832, 0.3677308261, -0.1180888265, -0.039293617, 0.1700598598, -0.1394597739, 0.4927858412, -0.2133516073, 0.0260658581, 0.3135809004, 0.1641211361, -0.321210146, -0.2611585855, -0.3593671322, -0.0353641249, -0.0426311158, 0.0828724355, 0.4474887848, -0.1211831197, 0.0169708841, 0.1829268187, 0.2554731071, 0.073159799, 0.0739675239, 0.3740550876, 0.0700121224, 0.4004065692, 0.5137107968, -0.0227792896, -0.3062431514, 0.1996745914, 0.263944149, -0.014320733, 0.6973946691, 0.1846508086, 0.3648733795, 0.2844780385, 0.0337654576, -0.2174205631, 0.1698567867, 0.1047149748, 0.1198458076, -0.050165683, 0.0078804661, -0.4404726624, -0.1537648886, -0.0058661061, -0.070318982, -0.3327952623, 0.0734069496, -0.0668126196, 0.0654349178, -0.0247058682, -0.2808012664, -0.1099704057, 0.6754774451, -0.1364127696, -0.1822149903, -0.1523166001, -0.1406024694, 0.432135433, 0.4079170227, -0.0529470928, 0.1072382331, -0.0599152036, -0.0789153948, 0.2173177898, 0.0980097353, -0.0897992551, 0.177473411, -0.4331851006, -0.2410423756, 0.00763109, -0.1011978313, 0.3845255375, 0.1653138399, 0.1407284737, 0.3100244105, 0.1142039672, 0.0501967929, -0.0555058382, 0.1272184551, -0.0078622084, 0.1683945209, -0.4091054499, 0.1022305787, -0.3346333206, -0.0675829127, -0.1973172128, -0.1512137502, -0.230019331, 0.0502039157, 0.1940101385, 0.0131132696, -0.0536454022, 0.1401582509, 0.0819327906, -0.360337764, 0.3539222479, 0.267024219, 0.0564558133, -0.2570888996, -0.1675048769, -0.303704232, 0.1231963485, 0.4289310277, 0.3278814554, 0.3765981197, -0.0242365748, 0.098927848, -0.1642771661, -0.3755143285, -0.1622452289, -0.162021935, 0.1337090284, -0.6391882896, -0.3137770295, -0.0577576272, 0.2944856286, -0.0273589138, 0.2157589346, 0.455478996, 0.3199614882, -0.1616205275, -0.0226113778, -0.3401669264, 0.3182310462, 0.6806934476, 0.1832423359, 0.2632364035, 0.1262328625, 0.0127972206, -0.2782559693, 0.0611337014, -0.4556923211, -0.0571735688, 0.0371971428, -0.1770211905, -0.047163751, 0.3318125904, 0.2001004219, -0.1217115894, 0.3218121529, 0.1192960292, 0.0384387821, -0.4937001765, 0.2479215264, 0.4585893154, 0.0407305993, 0.098855935, 0.0653120652, 0.1100175232, 0.3921361268, -0.0505035594, -0.2685379982, 0.6965744495, -0.0760935768, -0.0218542423, -0.0188632943, 0.441072911, -0.0197550897, -0.1611002833, -0.4324765205, -0.4226661921, 0.3406487405, -0.3558456302, -0.1867021024, 0.2179405838, 0.1376258582, -0.1097858027, -0.0341536552, 0.1473582834, 0.3316616714, -0.1459030807, 0.1566537619, 0.1557338983 ]
https://github.com/huggingface/datasets/issues/617
Compare different Rouge implementations
Updates - the differences between the following three (1) https://github.com/bheinzerling/pyrouge (previously popular. The one I trust the most) (2) https://github.com/google-research/google-research/tree/master/rouge (3) https://github.com/pltrdy/files2rouge (used in fairseq) can be explained by two things, stemming and handling multiple sentences. Stemming: (1), (2): default is no stemming. (3): default is with stemming ==> No stemming is the correct default as you did [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py#L84) Multiple sentences: (1) `rougeL` splits text using `\n` (2) `rougeL` ignores `\n`. (2) `rougeLsum` splits text using `\n` (3) `rougeL` splits text using `.` For (2), `rougeL` and `rougeLsum` are identical if the sequence doesn't contain `\n`. With `\n`, it is `rougeLsum` that matches (1) not `rougeL`. Overall, and as far as I understand, for your implementation here https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py#L65 to match the default, you only need to change `rougeL` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py#L86) to `rougeLsum` to correctly compute metrics for text with newlines. Tagging @sshleifer who might be interested.
I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off.
145
Compare different Rouge implementations I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off. Updates - the differences between the following three (1) https://github.com/bheinzerling/pyrouge (previously popular. The one I trust the most) (2) https://github.com/google-research/google-research/tree/master/rouge (3) https://github.com/pltrdy/files2rouge (used in fairseq) can be explained by two things, stemming and handling multiple sentences. Stemming: (1), (2): default is no stemming. (3): default is with stemming ==> No stemming is the correct default as you did [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py#L84) Multiple sentences: (1) `rougeL` splits text using `\n` (2) `rougeL` ignores `\n`. (2) `rougeLsum` splits text using `\n` (3) `rougeL` splits text using `.` For (2), `rougeL` and `rougeLsum` are identical if the sequence doesn't contain `\n`. With `\n`, it is `rougeLsum` that matches (1) not `rougeL`. Overall, and as far as I understand, for your implementation here https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py#L65 to match the default, you only need to change `rougeL` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py#L86) to `rougeLsum` to correctly compute metrics for text with newlines. Tagging @sshleifer who might be interested.
[ -0.0971115455, -0.1454415917, -0.1018338799, 0.244695574, -0.2790500224, -0.6873998046, 0.0966217667, 0.0406913422, -0.2773723304, 0.2449081689, -0.1052664518, 0.1245480105, 0.1565690786, 0.0299381055, 0.1508820653, -0.2753461599, 0.0824456736, 0.0195159987, -0.0070212879, -0.1224718243, -0.0989001542, 0.710848093, -0.1582221836, 0.02947977, -0.1360562593, 0.0632248074, -0.0651763752, 0.1977920383, -0.1465398073, -0.1077264771, -0.423838675, 0.2580071688, -0.0102515128, 0.5024158359, -0.0001064565, -0.2057290524, 0.1464959532, -0.0821158886, 0.0163352974, -0.0362424776, -0.1412747353, -0.1513668448, -0.0882193968, -0.127660051, -0.1156208292, -0.1115847751, -0.1406905204, 0.1013708934, 0.3020979166, 0.4619536996, 0.2020174414, -0.2780742645, 0.1017406583, -0.1463394016, 0.5364745259, -0.0650646687, 0.1783739477, 0.4277871251, 0.1088052168, -0.0589309186, -0.2776238024, 0.3784533441, 0.0932999253, -0.2227545977, -0.0347064026, 0.1359011382, -0.0522905327, -0.184051618, 0.0191417318, 0.5499541759, -0.0278987177, -0.1120535433, -0.5472530127, -0.0820498466, -0.1682859361, -0.3088392615, -0.0079200268, 0.2469450831, 0.0827692375, -0.0889341608, -0.0894186422, 0.0640295818, -0.1061206385, -0.17501764, -0.4134923518, 0.0716328695, -0.1481039524, -0.0499196686, 0.2254972309, -0.1386005282, -0.4518753886, 0.088442415, -0.2105748057, -0.2248036712, -0.2263537794, 0.0304092187, 0.2012510747, 0.2470629066, 0.15489465, 0.3268064857, 0.1311065555, 0.0373830758, 0.1005324125, 0.0954623148, -0.2064219117, 0.0200020336, 0.1247549802, 0.0741549954, 0.4574239552, 0.1187106892, -0.0139872385, 0.122483179, 0.2310453057, -0.4499969482, -0.216940701, 0.0168352835, -0.1520791054, -0.214142859, -0.4475258887, 0.0682153776, -0.4359625578, -0.0626248196, 0.052083388, 0.2803232074, -0.0924389139, 0.1899286956, 0.0190018937, 0.0347931609, -0.3867938221, -0.4065908194, -0.2543852925, 0.1753968894, -0.1582207829, -0.0041396641, 0.1424892843, 0.0595286489, 0.1201604605, 0.0901782811, 0.1998115033, -0.1900430471, 0.1238476858, -0.3567664027, -0.1528310478, -0.1231166795, -0.1686126739, -0.1810046732, -0.0722725987, -0.0784545541, -0.1086549684, -0.079853937, -0.3861470222, -0.0888706893, 0.2821954191, 0.254930526, -0.1683553755, -0.0753794461, -0.0070645357, 0.3652497828, 0.047145579, -0.2536486387, 0.2029475868, -0.3402795196, -0.3170868754, -0.1564066857, 0.1576575637, 0.149652034, -0.3296750784, -0.1588443369, 0.4732916057, 0.0124880308, 0.216986075, 0.4738480151, 0.0712080002, 0.1423043311, 0.015560071, 0.1054050773, 0.175556913, -0.3649574816, -0.2462285012, 0.2770295143, 0.1828015, -0.1516368687, 0.1605481505, -0.1878701448, 0.2899071574, -0.0099040708, 0.4108475447, 0.2934289277, 0.2333951145, 0.1149005964, -0.0389559567, 0.08852759, 0.1400678009, 0.0026704478, -0.1767751575, -0.2594025135, -0.007235032, -0.5122950673, 0.2567876875, -0.219950065, -0.0949148983, 0.4375616014, 0.0547257923, 0.2224574536, 0.3824208975, -0.0100099603, 0.0522029586, -0.1480381936, -0.9107894301, 0.1051265374, -0.1624166816, -0.128666535, -0.1426203996, -0.2644802332, 0.2685118914, -0.3495292962, 0.2174311876, 0.1194114089, 0.2412710637, 0.1883352995, 0.018059779, 0.4312151968, -0.0966070369, 0.136684224, -0.1902313232, 0.0697121024, -0.0828462839, -0.1460763514, 0.3277025819, 0.4177891016, 0.107045278, 0.1123865694, 0.1384595186, 0.4820682704, 0.4255561829, 0.2667172253, 0.0809958056, -0.063645035, 0.2385511696, -0.1907713115, 0.1061720476, 0.4484039247, 0.1561100334, 0.0829992667, -0.5478579998, 0.4688168466, -0.2570524812, 0.0163856931, 0.1720328629, -0.1505869776, 0.1022731885, 0.0802511722, -0.3891167641, -0.04439326, 0.3786428273, 0.2883982062, 0.5072108507, 0.0236742347, -0.2626599669, 0.0863703266, 0.4717359245, -0.2174663097, 0.2383185327, 0.0318506286, -0.1205307692, -0.299530983, 0.0457243286, 0.0068178275, -0.0083264075, 0.2829853594, 0.1845151633, -0.0496969968, -0.0539586879, -0.4153891206, 0.2375270277, -0.1250954121, -0.2692334354, 0.2895721793, 0.318487972, -0.0660477728, -0.4066005349, -0.4403742254, -0.1574130803, -0.004567516, -0.1147073209, 0.2354545891, -0.0973481014, -0.0767503902, 0.0552367158, -0.3195218444, -0.3229715228, -0.2448722422, 0.243819505, 0.0047330032, -0.141825825, -0.1242146567, 0.3198379874, 0.1610333323, 0.1131194159, -0.0448293909, -0.0473404415, -0.0999689177, -0.1550522745, 0.1665181518, -0.3360771239, 0.0314208716, 0.0443981923, -0.3856731057, -0.1498593688, -0.049860213, -0.4121781886, 0.3080254197, -0.1008326709, 0.0904307961, 0.3280989826, -0.3643452227, 0.0567746498, 0.3632389009, 0.1514818668, -0.2763025463, -0.2511568069, 0.2864519954, -0.1681542695, 0.1224939302, -0.2411346883, -0.4058033228, -0.0488452353, -0.2470818162, 0.3765843511, 0.1368348747, 0.1807423532, 0.2938694656, -0.0960830525, 0.0734527931, 0.2460884154, 0.3446044326, -0.2459904402, -0.077286534, 0.271096766, -0.4211296439, -0.42332986, -0.1781837046, 0.0295937043, -0.22265625, 0.3266165257, -0.0901060551, -0.2683165073, -0.2974975407, -0.020599043, 0.0652816594, 0.1605579257, 0.4207522869, -0.1087339446, -0.1601272672, -0.2147703618, 0.30066517, 0.1324686408, 0.0576619469, 0.1184684113, -0.1117347479, 0.3356944919, 0.1246399358, 0.1817938387, 0.6110420227, 0.4109736681, -0.1472968906, -0.1327874959, 0.1051607952, -0.2374239117, 0.4501042068, 0.2883417606, 0.1164884642, -0.1492542326, 0.415592283, 0.170495078, 0.0853630304, -0.0921644717, 0.0817558095, -0.0926126465, -0.3090034127, 0.0528822355, 0.2603553236, 0.2658607662, -0.2009758353, 0.142298311, 0.1658269614, -0.1431717426, 0.0257820338, -0.0636697337, 0.4361127913, 0.1187671125, -0.192791909, 0.2547781169, -0.5697330236, 0.3782300353, 0.2520796955, -0.1025371924, -0.0779548138, -0.1554356813, -0.014631493, -0.2424532324, 0.2306694537, -0.3393937349, -0.0417407826, 0.1037970185, -0.338876456, -0.4969875515, 0.0106605925, -0.6937623024, -0.095967941, 0.08937224, -0.0482522026, -0.500387609, 0.1068421751, 0.1828930825, -0.0426493511, 0.0415885262, 0.1271325201, -0.2671121061, -0.0529955514, 0.0766841248, 0.0952230766, 0.0646466389, 0.2550483346, -0.21730645, 0.04980582, 0.2746774554, -0.256114006, 0.3525842428, 0.1796700805, 0.3466416597, -0.3354485035, -0.3113317192, 0.0776263401, -0.111654453, 0.1052936763, 0.3015514016, -0.0927383676, -0.3703178465, 0.2278026342, -0.2204490602, 0.1226780266, 0.3488487005, -0.1216980889, 0.0580516085, -0.1321874261, 0.2628266513, -0.2526238263, -0.1727536917, 0.1578545272, 0.2081117481, -0.108481966, -0.2623505294, 0.1070525721, 0.3056501746, -0.2137509584, -0.1419988871, -0.0868672654, -0.3515120447, 0.2254665196, -0.1824957579, 0.8882472515, 0.2881526053, 0.2318198979, 0.2464225739, -0.2060982138, 0.4856417775, -0.5538764, 0.3664364219, -0.3987363577, -0.1991073787, -0.0963084698, -0.0561262704, -0.086209923, -0.0280220173, -0.3337031901, 0.4100313485, 0.007153987, 0.0599104613, -0.0034881516, 0.1867197603, -0.0764985457, -0.0226581376, 0.0743223354, 0.1884350628, 0.0009855349, 0.043477267, -0.1266752481, 0.0128381168, -0.4018338025, -0.1078990847, -0.0795297101, -0.0119308494, -0.0163799506, 0.2267965078, -0.0228111129, -0.6391393542, -0.3914238811, 0.4576610029, 0.166006729, 0.1854423881, -0.1440287679, 0.1402642727, -0.3095241785, 0.3136016428, 0.1122792885, -0.007560668, 0.1653445214, -0.0874928087, -0.1345496625, -0.0730032027, 0.0828045011, -0.273173362, -0.4576724172, 0.1336613446, -0.4114175737, -0.1679709554, 0.3816083074, 0.1423403472, -0.2837906182, -0.0725672394, 0.1663460135, 0.1209418625, -0.0679294467, 0.1607421935, -0.0545489527, -0.3273953795, -0.1977743655, 0.2310940027, 0.0633953512, 0.0514848195, -0.0855836421, 0.1746194214, -0.1256532222, -0.3106577098, -0.1957189739, 0.0224109255, -0.1284232587, 0.2936968803, -0.211602658, -0.0801140517, 0.1554589272, 0.3048992157, 0.0072226156, 0.1150606573, 0.1041508093, -0.3179343641, -0.1029888466, 0.4243270159, 0.0835590214, -0.0209632199, 0.1780697405, -0.0637656674, 0.1291880608, -0.008751356, -0.3982552886, 0.0700940117, 0.0439027883, 0.0695233718, -0.1887410134, -0.4910793304, 0.0962919071, 0.1348730028, 0.1042613387, 0.3069245219, -0.0105625512, -0.2076696754, -0.2314294279, 0.0660095066, -0.1553936303, 0.062584497, 0.1309310496, 0.1137332693, -0.0862927586, -0.3337722719, 0.3982596993, 0.2252205461, 0.2101084143, 0.1649029404, -0.2435774952, 0.1802207977, -0.1114251241, 0.0854098648, 0.096819751, 0.1067479551, -0.0056565823, 0.0913321748, -0.1165049449, -0.1035876423, -0.1371752471, 0.2953249216, 0.1966890246, 0.0181525033, 0.2846371531, 0.0069291969, -0.0362473577, -0.3335186541, 0.6811600327, 0.2897186577, -0.1604288965, -0.0128495861, -0.1669511199, 0.30590415, -0.1640090048, -0.0910126865, 0.1018712148, 0.0283459537, 0.2761339843, 0.4041278064, 0.1747853309, -0.0776228905, 0.102304779, -0.0922661275, 0.0974032804, -0.1086211354, 0.0788893551, -0.1504366249, 0.0693041682, 0.0775827542, 0.4464605451, -0.0243502613, 0.2357943058, 0.5418570042, 0.170206815, 0.0721822083, 0.2276642174, 0.3588779867, 0.291318953, 0.1977204382, -0.2707343996, 0.2905135155, 0.095903337, -0.0549215041, -0.1055886149, 0.1782446355, -0.1429118067, 0.2414572835, -0.246159628, 0.106093049, -0.1165651977, -0.3853594363, -0.2906481028, -0.2895009816, -0.2302589566, -0.007082026, -0.1021531969, 0.0588496625, 0.2445737123, 0.1722995937, 0.1638799459, -0.2813104391, -0.1577962488, -0.2306459695, 0.6589989066, -0.2258093953, 0.3789855838, 0.0600175261, 0.2099438012, 0.2982422411, 0.2825272083, 0.2726278007, -0.0003007998, -0.1618120968, -0.0062979497, -0.2738714218, 0.0020630262, -0.1665725857, 0.1828666031, 0.2584967613, -0.0665346161, 0.2456975281, 0.1705546081, -0.1593530029, 0.258398056, 0.1558145434, 0.1162889823, -0.1728272438, 0.213612482, 0.0240422767, 0.1233217493, -0.085503906, -0.1272457689, -0.4410177171, -0.1121007279, -0.1680353284, 0.1084946916, 0.02516062, 0.0635280609, 0.1330226064, 0.1738584638, -0.0746432692, 0.0802951455, 0.3782276809, 0.1270332038, -0.1432544291, -0.0927517861, -0.1001959592, -0.1376854628, 0.059174858, -0.253472358, 0.4507794678, -0.093061991, 0.264193058, 0.1324884146, 0.2620570958, -0.1844151914, 0.1038991436, -0.308026582, 0.2352760136, -0.1922250837, -0.0887038037, 0.0079621822, 0.0237385947, -0.0437168777, -0.0535071082, 0.0951554775, 0.0235946979, -0.2101690918, 0.1189058945, 0.1491819024, 0.2326222956, 0.5534223318, 0.2988826334, -0.0902613178, -0.237006709, -0.0626342967, -0.0594509393, -0.1318840981, 0.4863536358, -0.0554533638, 0.2033437341, 0.1254242808, -0.5329971313, 0.1028759778, 0.7695530057, 0.0413447842, -0.1699376106, -0.2594554424, -0.0285566188, -0.0032681311, -0.1611643881, -0.3714611232, 0.55631423, -0.094504036, 0.0448718071, -0.0440747216, -0.5466018915, 0.2392414957, -0.4795344472, 0.0947284698, -0.1087267324, 0.3924562335, 0.490278542, -0.0042809583, -0.0192576423, 0.0582682677, 0.1101681814, 0.043271143, -0.2417522967, 0.071872212, 0.0064340779, -0.0960606337, -0.2161063701, 0.4115978181, 0.2002280354, -0.3074800074, 0.0446099751, -0.3132918179 ]
https://github.com/huggingface/datasets/issues/617
Compare different Rouge implementations
This is a real issue, sorry for missing the mention @ibeltagy We implemented a more involved [solution](https://github.com/huggingface/transformers/blob/99cb924bfb6c4092bed9232bea3c242e27c6911f/examples/seq2seq/utils.py#L481) that enforces that sentences are split with `\n` so that rougeLsum scores match papers even if models don't generate newlines. Unfortunately, the best/laziest way I found to do this introduced an `nltk` dependency (For sentence splitting, all sentences don't end in `.`!!!), but this might be avoidable with some effort. #### Sidebar: Wouldn't Deterministic Be Better? `rouge_scorer.scoring.BootstrapAggregator` is well named but is not deterministic which I would like to change for my mental health, unless there is some really good reason to sample 500 observations before computing f-scores. I have a fix on a branch, but I wanted to get some context before introducting a 4th way to compute rouge. Scores are generally within .03 Rouge2 of boostrap after multiplying by 100, e.g 22.05 vs 22.08 Rouge2.
I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off.
144
Compare different Rouge implementations I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off. This is a real issue, sorry for missing the mention @ibeltagy We implemented a more involved [solution](https://github.com/huggingface/transformers/blob/99cb924bfb6c4092bed9232bea3c242e27c6911f/examples/seq2seq/utils.py#L481) that enforces that sentences are split with `\n` so that rougeLsum scores match papers even if models don't generate newlines. Unfortunately, the best/laziest way I found to do this introduced an `nltk` dependency (For sentence splitting, all sentences don't end in `.`!!!), but this might be avoidable with some effort. #### Sidebar: Wouldn't Deterministic Be Better? `rouge_scorer.scoring.BootstrapAggregator` is well named but is not deterministic which I would like to change for my mental health, unless there is some really good reason to sample 500 observations before computing f-scores. I have a fix on a branch, but I wanted to get some context before introducting a 4th way to compute rouge. Scores are generally within .03 Rouge2 of boostrap after multiplying by 100, e.g 22.05 vs 22.08 Rouge2.
[ -0.1379878074, 0.0537788421, -0.0650966018, 0.2345047742, -0.0384499803, -0.6865092516, -0.1374981999, -0.0325632468, -0.2779028416, 0.3952672482, -0.0672829002, 0.1716643721, 0.1589006633, 0.3637019396, 0.2211120278, -0.0784866884, 0.134586975, -0.0168794114, -0.10502626, -0.1088072807, 0.0128314989, 0.6053343415, -0.0310591105, 0.1092317179, -0.1490682214, 0.1322922558, 0.2132200152, 0.0989611819, -0.1409739256, -0.1004519016, -0.172893703, 0.1978752017, -0.1094240844, 0.4348337054, -0.0001064469, -0.1936360002, 0.171534434, -0.1881958991, 0.0778009817, -0.1544617116, 0.0580873899, -0.0233253203, -0.1111885607, -0.0384343304, -0.2476807386, -0.0726088807, -0.2509017587, 0.074823603, 0.155461967, 0.3872464001, 0.2037396729, -0.0639963672, 0.19576931, -0.2286603749, 0.5280541182, -0.0566641279, 0.0506691374, 0.524813056, -0.1208934858, -0.1075496301, -0.3474808633, 0.3372289538, 0.1901490837, -0.3185479939, 0.1235743091, 0.0154711707, -0.0340328775, -0.2019996792, -0.1000619084, 0.6137259007, -0.1752007902, 0.0161952227, -0.5487054586, -0.0667544752, 0.039324183, -0.1948319227, 0.0913071856, -0.0565150678, 0.0368624963, -0.1985514015, -0.0645337626, 0.3034346998, -0.0474749655, -0.1840780377, -0.1046659425, -0.0378050134, -0.1254391074, -0.0757325664, 0.4095122218, -0.1220964491, -0.5111021399, 0.3069497943, -0.1545221806, -0.0891522169, -0.5262224078, -0.0610734187, 0.1598897725, 0.4157990217, 0.2494132966, 0.4495763183, 0.3137443066, 0.0531716272, 0.0750584677, 0.0652157888, -0.3272766769, 0.0348076746, -0.0133847622, -0.0332114734, 0.3852160573, 0.1316891164, 0.0124617917, 0.1276688129, 0.3607760072, -0.5237597227, -0.287563622, 0.122860603, -0.4410627186, -0.3779607117, -0.4348493814, 0.1786827147, -0.58181566, -0.0216638241, 0.07356067, 0.1862040013, -0.1235138327, 0.2579783201, 0.0127919875, -0.0408548079, -0.3306753635, -0.2836543024, -0.2149547338, 0.074973695, -0.1546938866, 0.1803348511, 0.0942670628, -0.019029947, 0.1723968387, 0.0128591871, 0.1753637791, -0.2587373555, 0.0640309602, -0.2548102736, -0.1448668689, -0.0185465384, -0.1496223211, -0.2562121749, -0.0164534319, -0.1931045204, -0.1303746253, -0.1442645639, -0.1164204702, -0.043263685, 0.4312918186, 0.2439416349, -0.1952556372, -0.1667349041, -0.069685407, 0.2667292655, -0.2485961914, -0.1255652755, 0.1539246887, -0.2475670725, -0.2683535218, -0.0707556084, 0.3554470837, 0.1554045081, -0.1645864248, -0.1988320649, 0.5341031551, -0.0445962772, 0.0099407751, 0.3509601057, 0.1440036744, 0.3776942492, -0.0017384095, -0.1347106695, 0.2774408162, -0.3410016596, -0.2760170996, -0.0057497462, 0.1186542735, -0.0679779127, 0.1401613653, -0.0949997157, 0.0232432764, -0.0039749336, 0.1682725996, 0.2526460588, 0.0599442422, 0.0217985101, -0.145685479, 0.0653614849, 0.2068350613, 0.1683454812, -0.0439080596, -0.2805392146, -0.0583608001, -0.608435154, 0.3301959634, -0.1606406569, -0.3503606617, 0.3265832067, 0.0191344358, 0.1654942632, 0.2853589654, -0.0028770524, 0.1243407726, -0.0277981386, -0.8134548068, 0.1548521221, 0.1258449107, -0.1853111833, -0.3264547884, -0.1159100235, 0.3186032474, -0.4248640239, 0.1786703169, -0.0310021937, 0.4205989838, 0.1584351212, 0.0026369083, 0.3995906711, -0.1581783742, 0.1119306013, -0.3919112682, -0.0032040146, -0.0094383964, -0.1483701617, 0.2668650448, 0.4590809643, 0.1804876029, 0.1636718363, -0.0739021823, 0.4581428766, 0.3668297231, 0.0855820999, 0.1537888199, 0.185280636, 0.0301369, 0.0182524323, -0.1596735418, 0.5856784582, 0.136593014, 0.1660447419, -0.3437054753, 0.5487450361, -0.4739862382, 0.0545280576, 0.180081442, -0.1455040723, 0.074851267, 0.1776159555, -0.402684629, 0.0675393417, 0.4525695443, 0.1796042025, 0.5824772716, 0.0392692536, -0.2232959718, -0.0138714174, 0.2965692878, -0.2222269326, 0.1048380807, 0.0292699821, -0.0729204565, -0.1611635536, 0.0832692012, -0.0469199643, -0.0286680367, 0.2086729407, 0.0139422864, -0.0416533686, -0.1332061142, -0.4041920602, 0.1018149257, -0.1700232327, 0.0515732132, 0.2663270533, 0.24148871, 0.1121665239, -0.3807006478, -0.3593531251, -0.3606613874, -0.0638500303, -0.167847082, 0.1870643497, -0.1131302044, 0.0091961892, -0.1322093308, -0.219211936, -0.4324486852, -0.2986613214, 0.1582984775, 0.058557149, -0.1180022657, -0.0339628309, 0.3236486912, 0.2754863799, 0.0101450542, 0.0402029268, -0.0221719369, -0.0944165885, -0.2344564646, 0.176981777, -0.2460258752, -0.1812213659, 0.0618318915, -0.3107547164, -0.0086970795, 0.0190702602, -0.452658534, 0.2786201537, -0.1029075608, 0.2484101802, 0.2135020345, -0.4276445806, 0.0032280481, 0.4406082034, 0.1218785942, -0.328789413, -0.3009262681, 0.1931615919, -0.0724636614, 0.1929080635, -0.0872086138, -0.2683808506, 0.0207669158, -0.0987431183, 0.5206075907, 0.1144225746, 0.1009172797, 0.3030360043, -0.0912743509, 0.05631366, 0.0778946877, 0.1816981584, -0.201403439, -0.0219408292, 0.3603035212, -0.3418869078, -0.4680044651, -0.1450920701, 0.0597498119, -0.2673577368, 0.1555730999, -0.1215312928, -0.3317547739, -0.0737199262, 0.0234597102, -0.0890875459, 0.0716887489, 0.409211278, -0.2179150134, -0.0893819556, -0.1051585004, 0.0778064728, 0.1946630478, -0.1805390269, 0.1870250553, -0.1966018826, 0.3595888615, 0.045152545, 0.0217611697, 0.5290669799, 0.3862197101, -0.2149224132, -0.0533155464, 0.0830884501, -0.2630343139, 0.4513285458, 0.3552641869, 0.0063207117, -0.1950838715, 0.2531487644, 0.0723757222, 0.3628646731, -0.1058621183, 0.0236286316, 0.060157638, -0.3445745707, 0.036849726, 0.0886248425, 0.1257898062, -0.2093369216, 0.2825527489, 0.0262496509, -0.1072155014, 0.1978485882, -0.025167482, 0.3815749586, 0.1027462855, -0.1733493209, 0.2707930505, -0.4753193259, 0.3523249328, 0.1190910265, -0.0710649118, 0.0614492111, -0.2489382923, -0.0822234079, -0.2329116464, 0.3343763351, -0.2879669666, -0.0426406711, 0.1241562665, -0.2301526964, -0.3302977383, -0.1288579106, -0.3942029774, -0.3302256465, 0.0731103942, 0.0721996874, -0.2989215851, 0.0522131845, 0.3209912777, -0.1172248721, 0.0026302931, 0.1096910983, -0.2671666443, -0.1202242076, 0.1696537584, 0.145806402, -0.0550409257, 0.2817124128, -0.1646095812, 0.096565716, 0.0507512912, -0.1786047369, 0.3109717369, 0.2856432199, 0.3082370758, -0.2026076913, -0.1595375836, 0.1090663522, -0.1977570951, -0.1745832562, 0.3606680036, -0.0489382856, -0.3824969828, 0.1961780488, -0.2080850303, 0.201923579, 0.315005362, -0.0898812115, 0.1575021297, -0.2980256081, 0.1455923915, -0.4090366066, -0.080399856, 0.037645679, 0.1423520893, 0.1401459128, -0.2033579648, 0.3560957313, 0.3175187409, -0.2213910222, -0.3108109236, -0.0388195701, -0.1971378773, 0.4677297771, 0.0941876546, 0.844851017, 0.1214063317, 0.1850345582, 0.1718835384, -0.2384847403, 0.482398659, -0.5614011884, 0.1663890183, -0.5115355253, -0.2749325931, -0.0329950452, 0.0543624274, -0.0000916664, 0.2027968764, 0.0014262822, 0.5391433835, 0.228729099, 0.2562924922, 0.1209902465, 0.1763768792, 0.1043923795, -0.171002537, -0.173121199, 0.2126555443, 0.0154754901, 0.0278291553, -0.0779891536, 0.1016247496, -0.509616971, 0.0388417765, -0.0475017577, 0.0537026115, -0.361425519, -0.0153731955, 0.2476604134, -0.5977812409, -0.4231725335, 0.4159292579, 0.2904120386, 0.3292413056, -0.0346556865, 0.1431696713, -0.1709622443, 0.3200543821, 0.1805079877, -0.0252601132, 0.227232188, -0.0795198604, -0.1334783733, -0.0351766869, 0.2026480287, -0.3420898318, -0.2875038385, -0.0931457728, -0.354218483, -0.1526328325, 0.3578617573, -0.0374418423, -0.0467738621, -0.0479710996, 0.1659758091, 0.0911063179, -0.0351623856, 0.0553898737, 0.0553387813, -0.1962461025, -0.1203998774, 0.1445234269, -0.1053353325, 0.0237729326, -0.2270726711, 0.0759272575, -0.0387645587, -0.2073327303, -0.0831037834, 0.1247794554, -0.1594741195, 0.0426365919, -0.1619376838, -0.258841753, 0.077639319, 0.5247109532, 0.1725973636, -0.0272152983, 0.2617969811, -0.2476865351, -0.1904670149, 0.3711899221, 0.3751145303, -0.0460038856, 0.1523190588, -0.103645511, -0.1489115059, 0.1098960936, -0.391821444, -0.2247713804, -0.0893317387, -0.0843493566, -0.1334336698, -0.5113667846, 0.1355945766, 0.1119346619, 0.1190609708, 0.4008900225, -0.0387103111, -0.174530223, -0.2668005526, 0.0672653392, -0.0373618379, 0.1258927435, -0.038848415, 0.2830675244, -0.0477953143, -0.3878149092, 0.2133151144, 0.0649929121, 0.358887434, 0.120602563, -0.2820935249, 0.3386889398, -0.2158184201, 0.0978476107, 0.1097208858, 0.2145822793, -0.0102846306, 0.0225071795, -0.0935603157, -0.0362785161, -0.0905456841, 0.2599564493, 0.1787954122, 0.0101688365, 0.3479411304, 0.0176668838, -0.198702693, -0.2646785676, 0.5470198393, 0.2441311926, -0.0872399285, -0.1567056477, -0.1239551231, 0.2401516885, -0.2691856325, 0.0803487152, 0.0650191605, -0.0343373902, 0.1643130183, 0.5011048913, 0.1254831851, -0.0478972346, 0.1490360647, -0.0842954814, -0.0768763721, 0.0619587451, -0.0179571267, -0.3792603612, 0.2421420515, 0.0812412724, 0.55095011, -0.141809687, 0.2926925421, 0.1170537993, 0.1912472844, 0.0523614995, 0.0357893668, 0.3498684466, 0.0717567354, 0.0685831085, -0.0695198774, 0.3497826755, 0.1589657515, -0.0114230402, -0.1220554486, 0.1632859111, -0.1536622494, 0.030448379, -0.3204546273, -0.0838657692, 0.0096939132, -0.4271040261, -0.2785022259, -0.2624122202, -0.4468615055, 0.1273811013, -0.1581124812, 0.0449715406, 0.1046800464, 0.1011696532, 0.1346334219, -0.1836870313, -0.3204915524, -0.0897290707, 0.751645267, -0.2739137709, 0.3097507954, 0.0145214535, 0.2173309028, 0.1310404986, 0.2928341627, 0.0901147276, 0.0360215455, -0.2581721544, -0.0432589054, -0.1751988828, 0.1129977778, -0.0306167491, 0.2174671739, 0.1622586101, -0.0668793097, 0.3745431006, 0.1225539073, -0.1779458672, 0.1882739216, 0.0499313772, 0.3199845254, -0.2425407916, 0.1575740278, 0.1437198967, 0.259103179, -0.1944752485, -0.0446774848, -0.259272337, -0.1768309325, -0.4694058299, 0.1417611837, 0.053398136, -0.0886673853, 0.1231105253, 0.1777945459, 0.1758431494, -0.0021952665, 0.2403032184, 0.0196201541, -0.115364179, -0.1746169776, -0.0410734527, -0.0697483122, 0.1757573038, -0.1810773164, 0.2745837271, 0.0295502935, 0.3539459705, 0.0539209582, 0.1856224388, -0.0278199427, 0.1713767946, -0.2799512744, 0.122857213, -0.404921174, -0.299693644, 0.0162157416, 0.0775862485, -0.1081045792, -0.0085344464, 0.1224964559, 0.1487574279, -0.4328807592, 0.164602682, 0.1242289245, 0.3373118341, 0.4153502882, 0.2004424632, -0.0122654987, -0.4298879504, -0.1146634817, -0.0157830287, -0.2943869233, 0.3858155012, -0.3126730621, 0.2461763471, 0.2729097307, -0.2843562663, -0.0202983189, 0.6423119903, 0.0609293692, -0.3174877465, -0.1846443415, -0.0446748212, 0.1111225858, -0.2338801771, -0.3199439049, 0.4819262922, -0.0924897939, 0.3255458772, -0.0406466834, -0.2320199162, 0.1530935019, -0.3321329355, 0.3376567066, -0.0510520339, 0.3423324823, 0.4322220385, 0.0168739874, -0.2412811667, 0.0299358796, 0.0586191192, 0.1642423719, 0.0302766766, 0.1001573205, -0.134432748, -0.0817969739, -0.2281965762, 0.4084758759, 0.006279388, 0.0131902061, 0.1105070189, -0.3058946133 ]
https://github.com/huggingface/datasets/issues/617
Compare different Rouge implementations
> This is a real issue, sorry for missing the mention @ibeltagy > > We implemented a more involved [solution](https://github.com/huggingface/transformers/blob/99cb924bfb6c4092bed9232bea3c242e27c6911f/examples/seq2seq/utils.py#L481) that enforces that sentences are split with `\n` so that rougeLsum scores match papers even if models don't generate newlines. > > Unfortunately, the best/laziest way I found to do this introduced an `nltk` dependency (For sentence splitting, all sentences don't end in `.`!!!), but this might be avoidable with some effort. Thanks for the details, I didn't know about that. Maybe we should consider adding this processing step or at least mention it somewhere in the library or the documentation > #### Sidebar: Wouldn't Deterministic Be Better? > `rouge_scorer.scoring.BootstrapAggregator` is well named but is not deterministic which I would like to change for my mental health, unless there is some really good reason to sample 500 observations before computing f-scores. > > I have a fix on a branch, but I wanted to get some context before introducting a 4th way to compute rouge. Scores are generally within .03 Rouge2 of boostrap after multiplying by 100, e.g 22.05 vs 22.08 Rouge2. I think the default `n_samples` of the aggregator is 1000. We could increase it or at least allow users to change it if they want more precise results.
I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off.
210
Compare different Rouge implementations I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off. > This is a real issue, sorry for missing the mention @ibeltagy > > We implemented a more involved [solution](https://github.com/huggingface/transformers/blob/99cb924bfb6c4092bed9232bea3c242e27c6911f/examples/seq2seq/utils.py#L481) that enforces that sentences are split with `\n` so that rougeLsum scores match papers even if models don't generate newlines. > > Unfortunately, the best/laziest way I found to do this introduced an `nltk` dependency (For sentence splitting, all sentences don't end in `.`!!!), but this might be avoidable with some effort. Thanks for the details, I didn't know about that. Maybe we should consider adding this processing step or at least mention it somewhere in the library or the documentation > #### Sidebar: Wouldn't Deterministic Be Better? > `rouge_scorer.scoring.BootstrapAggregator` is well named but is not deterministic which I would like to change for my mental health, unless there is some really good reason to sample 500 observations before computing f-scores. > > I have a fix on a branch, but I wanted to get some context before introducting a 4th way to compute rouge. Scores are generally within .03 Rouge2 of boostrap after multiplying by 100, e.g 22.05 vs 22.08 Rouge2. I think the default `n_samples` of the aggregator is 1000. We could increase it or at least allow users to change it if they want more precise results.
[ -0.1199247539, 0.0578207672, -0.0259994734, 0.2475375086, -0.0194166508, -0.7114323378, -0.0715660527, -0.0210266747, -0.241076842, 0.3681191504, -0.0042178426, 0.175264433, 0.1229401007, 0.3598645031, 0.297547847, -0.1921322197, 0.098610498, -0.0162564386, -0.0499817058, -0.0920572802, -0.0059647895, 0.6030073166, -0.0572603904, 0.105635494, -0.1943649352, 0.1431976557, 0.1966949403, 0.0866382867, -0.119216159, -0.1853499413, -0.2451324314, 0.2077441216, -0.0349607207, 0.4523563981, -0.0001091167, -0.2276300192, 0.2159285098, -0.2167396843, 0.1104494482, -0.1605566293, 0.0378186963, -0.1098203659, -0.0797066838, -0.0814655945, -0.2882637084, 0.0072494466, -0.1965864897, 0.0967685357, 0.1674871594, 0.3560513854, 0.1705368608, -0.014753635, 0.1806709766, -0.2480338812, 0.5668405294, -0.0728995577, 0.062835969, 0.611348033, -0.0754704848, -0.0680765584, -0.3386307359, 0.3610009551, 0.1657430679, -0.3372177482, 0.0628841966, 0.1117007583, -0.0137625141, -0.1807055175, -0.0311418157, 0.6794784069, -0.1486427337, 0.0029163463, -0.4949690104, -0.0983797088, 0.0643409193, -0.3069669604, 0.1008419916, 0.071201019, 0.0650981739, -0.1525472403, -0.1313442737, 0.2446853817, -0.1071736664, -0.1755681336, -0.1494294405, -0.0151284225, -0.0904637277, -0.0794895887, 0.3360758722, -0.0673167855, -0.5943486691, 0.3752998412, -0.1992860287, -0.1545649469, -0.4956996441, -0.0426404588, 0.1276844591, 0.4336838424, 0.3025705814, 0.4458979964, 0.3535333872, 0.058815036, 0.1667740345, 0.0529167056, -0.228268072, 0.0254596937, -0.0179460645, -0.0743466839, 0.4144560993, 0.181135267, 0.0121967494, 0.1405446678, 0.4187541306, -0.5451746583, -0.1845692247, 0.1008503959, -0.3514789939, -0.3432898223, -0.367608279, 0.1872015595, -0.5367391706, -0.0158156082, -0.0174542088, 0.1968390048, -0.1532120556, 0.2220282853, 0.0514640212, 0.0718085319, -0.3348801136, -0.3064834177, -0.1950988621, 0.0791319981, -0.1510114968, 0.215507865, 0.0868385062, -0.0100456951, 0.2042096108, 0.0597338937, 0.138212204, -0.3667332828, 0.0484397747, -0.2148966938, -0.1565048993, -0.0596126467, -0.1266815513, -0.2758529484, -0.0598975942, -0.250865519, -0.1477454007, -0.1589676589, -0.1754635423, -0.0020290506, 0.4212624729, 0.2016869336, -0.2421361208, -0.1874313653, -0.0104135303, 0.2938572466, -0.130538553, -0.0845901221, 0.1509461552, -0.2787754536, -0.324457556, -0.0561416782, 0.3232984245, 0.2026695311, -0.1975644678, -0.2477600873, 0.6061242223, 0.0403277278, 0.0336668491, 0.3809576035, 0.1653749347, 0.3888627589, 0.0549484566, -0.0502895899, 0.192995593, -0.2700241506, -0.2422164828, -0.0212489832, 0.0832390264, -0.0768053234, 0.1449465901, -0.1102797017, 0.1698948741, 0.069111757, 0.1431253999, 0.2125445306, 0.1052324399, 0.0390273929, -0.1694835126, 0.023124883, 0.2083107829, 0.1826229244, -0.0441774428, -0.2475353181, -0.060221266, -0.5506238341, 0.3593121469, -0.233624652, -0.2559227049, 0.316903919, 0.0317747146, 0.1331079602, 0.2627292573, 0.0109733148, 0.1177087054, -0.0579707287, -0.8542649746, 0.2441545129, 0.0617074184, -0.169202432, -0.3705715239, -0.180585295, 0.3003233373, -0.4371095598, 0.1600411683, -0.0143353529, 0.3412572742, 0.2341626287, 0.0369940698, 0.4147162139, -0.1173599735, 0.1140118316, -0.4648657143, 0.0019417977, -0.0095590502, -0.2148295492, 0.31590873, 0.4534548223, 0.1284361929, 0.1765092313, -0.0494395867, 0.4062876999, 0.3399908245, 0.1041300371, 0.133308515, 0.0938197449, 0.0694995522, -0.0890277848, -0.1304594874, 0.5995197296, 0.1247306243, 0.1686527878, -0.3227337897, 0.598003149, -0.3787488937, 0.0463952236, 0.1247785166, -0.130030036, 0.1045122668, 0.1057683527, -0.397020936, 0.075627543, 0.4484716356, 0.191538021, 0.5518528223, 0.043386668, -0.3257264495, -0.0421126746, 0.3595897257, -0.1903334409, 0.1797347218, 0.0371973924, -0.0867275521, -0.1773939431, -0.0219606087, -0.0783404186, 0.0025476713, 0.2195887715, 0.0197210666, -0.0007428873, -0.1408706307, -0.439075619, 0.0764094293, -0.142920956, -0.0605829284, 0.3043666482, 0.2423511595, 0.0617749654, -0.4098843634, -0.2927573621, -0.3892459571, -0.0420891754, -0.195709914, 0.180743739, -0.0944134071, 0.1418758631, -0.1394219995, -0.1282728016, -0.5086533427, -0.2359363735, 0.2334480286, 0.0763521716, -0.1304823011, -0.0245748516, 0.303912133, 0.313480258, 0.0245653689, 0.0222486909, 0.0049759946, -0.1759688705, -0.235992223, 0.1460829526, -0.2856431603, -0.1068560705, 0.0836332962, -0.3754407465, -0.0247781742, 0.0332226306, -0.440969646, 0.254573226, -0.0748173892, 0.2755790055, 0.2000905573, -0.366266489, -0.042600695, 0.4201521277, 0.1592188179, -0.3122101426, -0.2852804363, 0.2487559617, -0.0951730311, 0.2048255056, -0.1195689961, -0.4127586186, 0.0095929373, -0.1093282998, 0.4913553596, 0.1069435999, 0.0888676941, 0.273688525, -0.0542881638, 0.0500337072, -0.0098212715, 0.2073386759, -0.1839258224, -0.0335972644, 0.3422642648, -0.3354377747, -0.5135300159, -0.1427980363, 0.0637117103, -0.2013811618, 0.2057772875, -0.1288751364, -0.2995450795, -0.0593245104, -0.0508389845, -0.055118829, 0.0820387378, 0.4349640906, -0.2504157722, -0.0757331997, -0.1027089432, 0.083833918, 0.3216791451, -0.1883359849, 0.2084261775, -0.1588685215, 0.3865532279, 0.0372824594, 0.0425755754, 0.6114041805, 0.3491764367, -0.1800513268, -0.0786045715, 0.0960943103, -0.2694200873, 0.4766199887, 0.2780719101, -0.015518629, -0.1733075678, 0.3527803421, 0.0544787385, 0.2919141054, -0.1228649095, -0.0032973043, -0.0022115458, -0.4111377299, 0.0852209032, 0.2045761496, 0.200759992, -0.2420279831, 0.2248528153, 0.0827758834, -0.1478873789, 0.1690864712, 0.059940394, 0.4045788944, 0.1620069891, -0.201012969, 0.2774576247, -0.4924327731, 0.3232815564, 0.1231624782, 0.0037519766, 0.0346341468, -0.2645381689, -0.0398272499, -0.1963595003, 0.2720934451, -0.3343456388, -0.0398722924, 0.0852226764, -0.2270897627, -0.26265499, -0.0394851156, -0.4668118954, -0.4294914305, 0.1189717576, 0.0257227439, -0.4162073433, 0.1408767402, 0.294952035, -0.0939941034, -0.0376577266, 0.0707490072, -0.3008877933, -0.1250914931, 0.1245119646, 0.227399677, 0.0153753422, 0.2816197276, -0.188291952, 0.0350892842, 0.0939710289, -0.1933539063, 0.2874555886, 0.3182860315, 0.3587849438, -0.2967596054, -0.1858538091, 0.1272568852, -0.1283437163, -0.1919142902, 0.3262424171, -0.0692248344, -0.4199405611, 0.2371011972, -0.2747510076, 0.1988111585, 0.351726383, -0.0434973352, 0.2319826335, -0.2294518948, 0.1682387441, -0.3555620313, -0.1029996797, -0.006956818, 0.1039783135, 0.100592725, -0.1379528791, 0.3263964653, 0.2669789791, -0.1933409423, -0.4485456347, -0.0590690784, -0.2420430779, 0.4088695645, 0.033507891, 0.9406027198, 0.1146584302, 0.2159932703, 0.1509402245, -0.2938792706, 0.4857125282, -0.4107209444, 0.1659614742, -0.5914515257, -0.1540634036, -0.0236731526, 0.0152197713, 0.0090300674, 0.2254935503, -0.1336909384, 0.5277875066, 0.1549180895, 0.2343394458, 0.0684798285, 0.2131847739, 0.0914742649, -0.1363697648, -0.2000812292, 0.1548396498, -0.0257828981, 0.0350450501, -0.0692337304, 0.0165991616, -0.4950157404, 0.0172243435, -0.0018318086, 0.0330697782, -0.249398604, -0.0405303799, 0.2403571159, -0.6468831897, -0.3628730774, 0.4100303054, 0.3001851141, 0.3615040183, -0.1065692008, 0.1137766317, -0.2730528712, 0.2960499525, 0.2464793026, -0.0022384182, 0.1830040962, -0.0635611489, -0.1858989447, -0.048087988, 0.191734165, -0.350848496, -0.2901608944, -0.0844339207, -0.3248624206, -0.1663081199, 0.395793438, -0.0780092478, -0.0337802507, -0.0825269073, 0.1380173266, 0.1615870297, 0.0219266936, 0.0516947098, 0.0785889775, -0.2714340985, -0.14667207, 0.099982053, -0.0620629974, 0.0250700396, -0.1733116359, 0.1120143607, -0.0616239309, -0.2199274004, -0.0949831381, 0.121654965, -0.3167488575, 0.0629123896, -0.0662864447, -0.1874001771, 0.0848548859, 0.454149574, 0.1611184776, -0.0432565138, 0.236588344, -0.284491539, -0.1792443395, 0.4154626429, 0.3380750716, -0.0232428685, 0.1925076544, -0.0853182673, -0.0687431395, 0.0929524899, -0.3633159995, -0.2334937602, -0.0807269067, -0.0226743929, -0.0575195514, -0.5269913673, 0.0452140048, 0.1302616149, 0.0717528462, 0.3796460927, -0.0466159806, -0.139340207, -0.2948295772, 0.086327821, -0.0445368029, 0.2001894712, -0.0187497754, 0.2959344387, -0.0253694877, -0.3763460815, 0.2337668091, 0.007659832, 0.3363522291, 0.1284156442, -0.2368224263, 0.3274033666, -0.2537735105, 0.0768030584, 0.0251886416, 0.108215332, 0.0066505782, 0.01603912, -0.111523807, -0.0190690272, -0.0546857528, 0.295034647, 0.261195451, 0.0595225915, 0.3306886554, -0.0011622339, -0.2251049131, -0.2662789524, 0.5229459405, 0.2373593897, -0.0539457239, -0.203350693, -0.0982934684, 0.2226357311, -0.2943921983, 0.0724179745, 0.0778273791, -0.0986255407, 0.1442731768, 0.4975626171, 0.1614878923, -0.0648139641, 0.1025291234, -0.0809711516, -0.0199595224, -0.0075995498, 0.0267789103, -0.3497165442, 0.2409503758, 0.070493333, 0.5140092969, -0.1148748547, 0.2195925564, 0.0879006013, 0.2013388872, 0.0343094468, 0.0216832608, 0.4369773865, 0.0568812862, 0.1682255417, -0.1973410696, 0.3928688467, 0.139146328, 0.0145086087, -0.1283884048, 0.2978077531, -0.1089277864, 0.0387911126, -0.345605582, -0.0703532547, 0.0274056103, -0.4653735161, -0.2823558152, -0.2791446745, -0.4714231789, 0.1094113961, -0.1195451617, 0.0771694705, 0.115401186, 0.1312568784, 0.1319937408, -0.2858126462, -0.3366744518, -0.1074162871, 0.6733067632, -0.3037387729, 0.2952613235, -0.040176753, 0.2007911056, 0.1491848975, 0.3282280266, 0.0973954648, 0.0338950045, -0.2017311305, -0.0645838827, -0.1578636914, 0.1661272347, -0.0251393467, 0.1989769638, 0.2382316291, -0.1389899552, 0.2985790074, 0.0918388963, -0.1330918521, 0.2325232625, 0.0410572067, 0.3143247366, -0.2229613811, 0.176420182, 0.1007427201, 0.238291502, -0.209222436, -0.1073142439, -0.3077575564, -0.1275486201, -0.4239982367, 0.1715763956, 0.0421766751, -0.1228060797, 0.1027342081, 0.1181354225, 0.1602741927, -0.0267962199, 0.2585562766, 0.0192661993, -0.0747787952, -0.198117435, -0.0183104072, -0.0648414344, 0.1657656878, -0.2037340999, 0.3187339008, -0.0221433286, 0.3684746921, -0.0281961635, 0.2310347706, -0.0696301982, 0.1423704177, -0.3201332688, 0.1295228302, -0.3543376029, -0.2733687162, 0.0231843144, 0.1113181859, -0.060181018, -0.0097247772, 0.0663770288, 0.1673560441, -0.3448729515, 0.1648918986, 0.1763140261, 0.2991236746, 0.4876227975, 0.2544555068, -0.0168120582, -0.395435065, -0.1899195015, -0.065043658, -0.2933446169, 0.4509835243, -0.2019189596, 0.3059761822, 0.2800116241, -0.2772436738, -0.0059781345, 0.7327028513, 0.0470348001, -0.3717378378, -0.1414089799, -0.1147764102, 0.1800148338, -0.259280622, -0.3121396303, 0.404166013, -0.0878885612, 0.2905736566, -0.012239255, -0.3303338587, 0.163730979, -0.3309815228, 0.2920037508, -0.0520891137, 0.388861686, 0.4497039616, 0.0056047486, -0.3092065752, 0.0215133037, 0.0359865651, 0.1832431257, 0.0314045399, 0.1259144098, -0.096460551, -0.1132311597, -0.2234430909, 0.4332585633, 0.0445491225, -0.0269826483, 0.0888876766, -0.3598042428 ]
https://github.com/huggingface/datasets/issues/617
Compare different Rouge implementations
Hi, thanks for the solution. I am not sure if this is a bug, but on line [510](https://github.com/huggingface/transformers/blob/99cb924bfb6c4092bed9232bea3c242e27c6911f/examples/seq2seq/utils.py#L510), are pred, tgt supposed to be swapped?
I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off.
25
Compare different Rouge implementations I used RougeL implementation provided in `datasets` [here](https://github.com/huggingface/datasets/blob/master/metrics/rouge/rouge.py) and it gives numbers that match those reported in the pegasus paper but very different from those reported in other papers, [this](https://arxiv.org/pdf/1909.03186.pdf) for example. Can you make sure the google-research implementation you are using matches the official perl implementation? There are a couple of python wrappers around the perl implementation, [this](https://pypi.org/project/pyrouge/) has been commonly used, and [this](https://github.com/pltrdy/files2rouge) is used in fairseq). There's also a python reimplementation [here](https://github.com/pltrdy/rouge) but its RougeL numbers are way off. Hi, thanks for the solution. I am not sure if this is a bug, but on line [510](https://github.com/huggingface/transformers/blob/99cb924bfb6c4092bed9232bea3c242e27c6911f/examples/seq2seq/utils.py#L510), are pred, tgt supposed to be swapped?
[ -0.0462396555, -0.3402345181, -0.0140984543, 0.3791038692, -0.0787524059, -0.6177636385, 0.0081205843, 0.0337360837, -0.3628863096, 0.3499980271, -0.2657789588, -0.1302829534, 0.1970667243, 0.2637876868, 0.2604076564, -0.2404888868, 0.0870678052, -0.0158298891, -0.3073504269, -0.1472104043, -0.1258979887, 0.7282140255, -0.1187527478, 0.1422055811, -0.1178555414, 0.3190755844, 0.0754644573, 0.1428856403, -0.0769110844, 0.0503387749, -0.0773926973, 0.1364056915, 0.0535054654, 0.6272999048, -0.0001120195, -0.0545935705, 0.0474306494, -0.1357921511, 0.0693164915, -0.02282276, -0.1206798851, -0.1080062315, -0.1051929668, -0.1453910023, -0.2766062319, -0.1439554393, -0.2889889479, 0.202690959, 0.2424776554, 0.4388735294, 0.1830443144, 0.0371563807, 0.1999945492, -0.1163281873, 0.5332651138, -0.0113954227, 0.0095241079, 0.4414728284, 0.0845700428, 0.0121363038, -0.1068576276, 0.2801780403, 0.2016870975, -0.2245487124, 0.0831992775, 0.1899205148, 0.064667955, -0.0947261751, 0.0609513856, 0.4944716096, -0.0338065289, -0.2444934845, -0.4565925002, 0.0317238793, -0.2688064277, -0.3344598114, 0.0806372836, 0.0214646701, 0.3556171358, -0.0614487082, -0.2099114805, 0.0630045459, -0.0412148237, -0.2200860232, -0.421642065, -0.0584215038, -0.1846102327, 0.0430524386, 0.1635531485, -0.140541181, -0.5604935884, 0.2374847084, -0.1599112153, -0.1976955384, -0.353138268, -0.1151281968, 0.1373970807, 0.3342141807, 0.037152756, 0.4631065726, 0.1254406124, 0.1216641217, 0.0856847614, 0.0586967729, -0.3227405548, 0.2932857871, -0.1890388578, 0.1720277816, 0.3554431796, 0.0926142111, 0.0749710426, 0.0584118329, 0.4156943262, -0.6989452243, -0.2002401054, 0.0524525382, -0.1671945304, -0.4326245189, -0.4299027324, -0.0271915197, -0.1767519861, -0.0308982674, 0.1167363897, 0.1503121108, -0.1495215595, 0.0424440652, 0.1605865508, -0.0055335085, -0.5098376274, -0.1614809781, -0.2780582607, 0.1651214957, -0.1665261835, 0.1229583547, 0.0699659809, 0.1001441032, 0.2009734809, 0.0961459354, 0.1871933788, -0.0009885877, 0.1759390533, -0.0594165698, -0.1663110405, 0.1371475905, -0.1835513711, -0.0147339543, 0.0321945176, 0.0244993232, -0.1782719791, -0.2502810061, -0.4921044707, -0.1060734689, 0.2954382002, 0.1907459497, -0.2942809761, -0.0692165941, -0.1578973085, 0.2298373878, -0.0357161425, -0.5121925473, 0.0543526746, -0.301894784, -0.3901178837, -0.1606630385, 0.3361692727, 0.1987193674, -0.1800176203, -0.1948148757, 0.5356314182, -0.0672031417, 0.1107068434, 0.4747157395, 0.0492932051, 0.005550148, -0.1745308489, -0.2681954205, 0.1999703348, -0.4523170888, -0.3830572367, 0.0476568341, 0.0821940824, -0.2138219774, 0.1366917938, -0.1346653998, -0.0554780141, -0.1711652875, 0.1451753825, 0.0700775832, 0.0844068155, 0.09820088, -0.2546146512, 0.0316347964, 0.2501723468, 0.0316303782, -0.0061234222, -0.0144205298, -0.0123522785, -0.4560584128, 0.1696414649, -0.0568990372, -0.1102580279, 0.3962093294, -0.0250279047, 0.0397522487, 0.3803073466, 0.17110309, -0.174119547, -0.0921757817, -0.9340211749, 0.1069794148, 0.1560131013, -0.0174837988, -0.4241197109, -0.2808052599, 0.3445940316, -0.4135505855, 0.1371365041, -0.0728043988, 0.3419047892, 0.179904148, 0.2065048218, 0.303301692, 0.2343679816, 0.0536502749, -0.3724866211, 0.1102485284, -0.0694720075, -0.085807398, 0.2577385306, 0.3375181258, 0.2463003844, -0.0221804287, -0.0713822469, 0.4225409329, 0.288546443, 0.3854729235, 0.3367462754, 0.4276494086, 0.2519126832, -0.2109386772, -0.1562892348, 0.5646336079, 0.1081747636, 0.0383513905, -0.4680087566, 0.5065366626, -0.2661360204, -0.0121040959, 0.1127237827, -0.0463255569, 0.0814126953, 0.0910871997, -0.3921841979, 0.1565762013, 0.291778028, 0.3464290798, 0.6304525137, 0.1406929344, -0.0967634097, 0.1004110724, 0.3997436762, -0.1017154157, -0.0067251702, 0.1135699153, -0.1569253951, -0.2928295135, 0.1107683629, -0.0893805102, 0.0598921292, 0.209700793, 0.1487043053, 0.0371915251, -0.1481205374, -0.3523477912, 0.0504465476, -0.1629637927, -0.2154396474, 0.1390166134, 0.1744087636, 0.0353202969, -0.2427976578, -0.2507173717, -0.2253891081, 0.1806871742, -0.2774430215, 0.2457856387, 0.0038502987, 0.257487148, -0.0747100413, -0.3186457753, -0.395464927, -0.2954206765, 0.2648133636, 0.0942245573, -0.1397354603, 0.080623731, 0.2114582807, 0.1704192907, 0.1263624281, -0.0609066039, -0.2691187859, 0.067047447, -0.3442387581, 0.1047259197, -0.2446594983, -0.078862153, 0.0806711912, -0.4296240509, 0.0975875482, -0.1162439436, -0.5498436689, 0.1776525229, 0.0356233343, 0.3770742118, 0.188141644, -0.3002073169, -0.0184458755, 0.47107023, 0.2002330273, -0.3231211007, -0.1657702476, 0.3012694418, -0.2839273214, 0.229491055, -0.2235215753, -0.3297276795, 0.0143191488, -0.0862902552, 0.283446759, 0.1472924352, 0.0925279781, 0.2298971862, 0.0649151504, -0.1279925406, 0.3870963454, 0.1898576021, -0.3099277616, -0.2520887554, 0.3893832564, -0.3500760794, -0.5373865366, -0.2022144347, 0.0193115436, -0.0161611289, 0.2700973749, -0.1697931439, -0.3686192036, -0.3688879311, -0.1145495549, 0.0201561432, 0.1319061667, 0.4350543022, -0.1713930666, -0.1104348972, -0.2714863718, 0.0526836514, 0.1724311709, -0.0486955941, 0.2192722559, -0.0858299807, 0.2024037093, -0.0671014339, 0.3914041221, 0.4602388442, 0.124439694, -0.0473765917, -0.1539423615, 0.2863889933, -0.1996271461, 0.2588321269, 0.1851467341, 0.2490404844, -0.0616736263, 0.3672215641, 0.2207795382, 0.2248216867, -0.1708765626, 0.2625945807, -0.1587225944, -0.3359984159, -0.0841349289, 0.3974851072, 0.1898152083, -0.0296097416, 0.0822151974, -0.0941659361, -0.1437632442, 0.2429081202, 0.1454964131, 0.3763531446, 0.2039706409, -0.1141540334, 0.1987541169, -0.6007116437, 0.4602783322, -0.0555290058, -0.0449599139, -0.0817773119, -0.138131991, -0.0442634933, -0.2185065895, 0.2711826265, -0.2302885503, 0.0479131266, 0.1509726197, -0.4011392295, -0.3824822903, -0.0977542251, -0.4528390169, -0.2298430055, 0.2018158287, 0.2029630244, -0.5372373462, -0.073570013, 0.0599507801, -0.1079466566, -0.1870278418, 0.2506590188, -0.2709745467, -0.2244587541, 0.2324507982, -0.0348379351, 0.011221474, 0.2210059166, -0.2367370129, 0.1307558715, 0.222387448, -0.1823405176, 0.2928214073, 0.2518827021, 0.4831475019, -0.2346964926, -0.1617091149, 0.1818934083, -0.0874765441, 0.0406562239, 0.3343544602, 0.0864176601, -0.2289610505, 0.4154286981, -0.0384382717, -0.0139006423, 0.2383219451, -0.1080385894, 0.013707079, -0.1961786002, 0.3133017421, -0.4277527332, -0.0448634699, 0.207324475, 0.1391385198, -0.048864942, -0.233349368, 0.2371946126, 0.3299580216, -0.2377563864, -0.2284529656, 0.054280784, -0.2001759112, 0.1643240452, 0.0023745752, 1.0280890465, 0.1047325209, 0.2302794755, 0.2844596207, -0.3621207774, 0.2803663909, -0.4588988721, 0.1027160808, -0.5660180449, -0.2690150738, -0.0265094284, -0.0703130141, -0.1234998778, -0.1072545052, -0.1337422282, 0.4592171907, 0.1445998549, 0.1331366599, -0.0539650209, 0.1167642921, 0.1683041304, 0.004850518, 0.1752374619, 0.1566209048, 0.0639585331, 0.2994735539, -0.1798164546, -0.0644774809, -0.5498411655, -0.0796332061, -0.0305485893, -0.1351214796, 0.0250811987, 0.2051969767, -0.0030893807, -0.5478057861, -0.4278320372, 0.4673519135, 0.3638889194, 0.1543485075, -0.2965243459, 0.1685762852, -0.4701937735, 0.3899486661, 0.0743403658, 0.115604721, 0.0724761486, -0.0994995981, -0.0437541604, -0.0537648201, 0.1490104496, -0.250687927, -0.6245262027, -0.1295892894, -0.5371047258, -0.3104640841, 0.5415863395, -0.0805539638, -0.1622420251, -0.0381718725, 0.1411792338, 0.2169871628, -0.0275868122, 0.3249526024, 0.0393103622, -0.4234243929, -0.1621246636, 0.3064824343, 0.0121894516, -0.0430700667, -0.0259228442, 0.0730396956, 0.0162073243, -0.1115277559, -0.1409135163, 0.1159518212, -0.4342994094, 0.2139222026, -0.0991931632, -0.025300255, 0.1100040078, 0.4212901592, 0.23358123, 0.0027088465, 0.2833832204, -0.1890314817, -0.314574033, 0.41799137, 0.1682230085, 0.1861318052, 0.0181395486, -0.1133889258, 0.1064387634, 0.0218629036, -0.365616709, 0.0785604045, -0.0261600185, 0.0308772419, -0.1768047512, -0.4855467081, 0.1199008673, 0.1508076042, 0.0167066753, 0.066363506, -0.282602042, -0.1009671092, -0.3385393918, 0.0959462151, -0.1007136106, -0.045422636, -0.0591186732, 0.2864866257, -0.0228680391, -0.2581018806, 0.2471313477, 0.1842891276, 0.3011257052, 0.1415243298, -0.1482150257, 0.0849047601, -0.1509346217, 0.1452334225, 0.3150300682, 0.0186423827, -0.0567419864, 0.0243448447, -0.1893321425, -0.1604846865, 0.0903148875, 0.1853343099, 0.2324613631, 0.0039607263, 0.3097012937, 0.0568218045, 0.0860442072, -0.1042043641, 0.6678873301, 0.1300582588, -0.0921560451, -0.0505932011, -0.1103083789, 0.1822526753, -0.1761769205, 0.0433171168, 0.1966628879, 0.0390418284, 0.1300089359, 0.3549924791, 0.2215701789, 0.0620077327, 0.4383102953, -0.0137923462, 0.1863244325, -0.135926649, -0.0669820681, -0.2568196356, -0.0755849555, 0.2242778391, 0.5384520292, -0.0414159931, 0.2130906284, 0.2482745051, 0.1608665437, 0.0557455942, -0.0978939608, 0.1659346372, 0.1322990507, -0.0367493369, -0.3595759273, 0.2460225075, 0.1544193327, 0.0825495198, -0.0643203631, 0.2218964249, -0.1357972622, 0.1727038771, -0.3701015413, 0.0143402461, -0.1660200804, -0.4361302853, -0.1228218302, -0.3909068406, -0.2636038065, 0.090325959, -0.0920612291, 0.0655298904, 0.2612421215, 0.022443369, -0.0183028355, -0.0816772655, -0.4220668077, 0.0550420396, 0.4008121192, 0.0048686475, 0.2830742002, 0.1144409999, 0.0623962283, 0.2156859487, 0.3841760755, 0.1169888899, -0.0475929528, -0.17498447, -0.0584876798, 0.1209591627, 0.1552110463, -0.110954389, 0.2898358703, 0.1443903744, -0.3088456988, 0.1412969679, 0.1111896634, -0.128955543, 0.2223318368, -0.2095450908, 0.2623898387, -0.2080375552, 0.1602803767, -0.1594027728, 0.1173659042, -0.1060338169, -0.1884705722, -0.3168028295, -0.1629391611, -0.3557918072, 0.1665894985, 0.188627556, -0.0896943957, 0.0911408439, 0.1815398037, 0.0131883156, 0.0751547515, 0.2211912721, -0.0654822588, -0.1103832051, -0.240724802, 0.1426548809, 0.0655630007, 0.3086325824, -0.2443653643, 0.292224139, -0.0720490739, 0.1290785968, 0.3750627935, 0.1218331158, 0.1178664714, 0.2167736739, -0.3038438559, 0.1798719317, -0.3895222247, -0.1668028384, 0.0952640101, 0.098760806, 0.0573724397, 0.0368032232, 0.1220120192, -0.1249687597, -0.1437062323, 0.1236509755, 0.2193995416, 0.3691053092, 0.5210086107, 0.2177212238, -0.1560083926, -0.1310567111, -0.1762015671, -0.1141322777, -0.0443405136, 0.1646039039, -0.3079449832, 0.0857177153, 0.1169650927, -0.5630624294, -0.1023761556, 0.6308068037, 0.0810668617, -0.3098793328, -0.1672501564, -0.0631318018, 0.0277876463, -0.3235364556, -0.2412039787, 0.5562443733, 0.0396712273, 0.2578610778, -0.1080273688, -0.3692851365, 0.4570889473, -0.3373158872, 0.2436263859, -0.1098592654, 0.353484273, 0.4649353325, -0.0062324251, 0.0651137084, 0.1634216458, 0.0482459925, 0.1417991072, 0.0699141547, 0.1563729793, -0.051443208, -0.122545816, -0.1321688294, 0.6715167761, 0.179833442, -0.1915445924, 0.213578254, -0.1527657211 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
I think the only way to avoid this warning would be to do a copy of the numpy array before providing it. This would slow down a bit the iteration over the dataset but maybe it would be safer. We could disable the copy with a flag on the `set_format` command. In most typical cases of training a NLP model, PyTorch shouldn't modify the input so it's ok to have a non-writable array but I can understand the warning is a bit scary so maybe we could choose the side of non-warning/slower by default and have an option to speedup. What do you think @lhoestq ?
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
106
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. I think the only way to avoid this warning would be to do a copy of the numpy array before providing it. This would slow down a bit the iteration over the dataset but maybe it would be safer. We could disable the copy with a flag on the `set_format` command. In most typical cases of training a NLP model, PyTorch shouldn't modify the input so it's ok to have a non-writable array but I can understand the warning is a bit scary so maybe we could choose the side of non-warning/slower by default and have an option to speedup. What do you think @lhoestq ?
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
@thomwolf Would it be possible to have the array look writeable, but raise an error if it is actually written to? I would like to keep my code free of warning, but I also wouldn't like to slow down the program because of unnecessary copy operations.
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
46
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. @thomwolf Would it be possible to have the array look writeable, but raise an error if it is actually written to? I would like to keep my code free of warning, but I also wouldn't like to slow down the program because of unnecessary copy operations.
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
Well because I don't know the internal of numpy as well as you I guess hahahah, do you want to try to open a PR proposing a solution?
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
28
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. Well because I don't know the internal of numpy as well as you I guess hahahah, do you want to try to open a PR proposing a solution?
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
@thomwolf @AndreasMadsen I think this is a terrible idea, n/o, and I am very much against it. Modifying internals of an array in such a hacky way is bound to run into other (user) issues down the line. To users it would not be clear at all what is going on e.g. when they check for write access (which will return True) but then they get a warning that the array is not writeable. That's extremely confusing. If your only goal is to get rid of warnings in your code, then you can just use a [simplefilter](https://docs.python.org/3.8/library/warnings.html#temporarily-suppressing-warnings) for UserWarnings in your own code. Changing the code-base in such an intuitive way does not seem like a good way to go and sets a bad precedent, imo. (Feel free to disagree, of course.) IMO a warning can stay (as they can be filtered by users anyway), but it can be clarified why the warning takes place.
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
155
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. @thomwolf @AndreasMadsen I think this is a terrible idea, n/o, and I am very much against it. Modifying internals of an array in such a hacky way is bound to run into other (user) issues down the line. To users it would not be clear at all what is going on e.g. when they check for write access (which will return True) but then they get a warning that the array is not writeable. That's extremely confusing. If your only goal is to get rid of warnings in your code, then you can just use a [simplefilter](https://docs.python.org/3.8/library/warnings.html#temporarily-suppressing-warnings) for UserWarnings in your own code. Changing the code-base in such an intuitive way does not seem like a good way to go and sets a bad precedent, imo. (Feel free to disagree, of course.) IMO a warning can stay (as they can be filtered by users anyway), but it can be clarified why the warning takes place.
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
> To users it would not be clear at all what is going on e.g. when they check for write access (which will return True) but then they get a warning that the array is not writeable. That's extremely confusing. Confusion can be resolved with a helpful error message. In this case, that error message can be controlled by huggingface/datasets. The right argument here is that if code depends on `.flags.writable` being truthful (not just for warnings), then it will cause unavoidable errors. Although, I can't imagine such a use-case. > If your only goal is to get rid of warnings in your code, then you can just use a simplefilter for UserWarnings in your own code. Changing the code-base in such an intuitive way does not seem like a good way to go and sets a bad precedent, imo. I don't want to ignore all `UserWarnings`, nor all warnings regarding non-writable arrays. Ignoring warnings leads to hard to debug issues. > IMO a warning can stay (as they can be filtered by users anyway), but it can be clarified why the warning takes place. Plain use cases should really not generate warnings. It teaches developers to ignore warnings which is a terrible practice. --- The best solution would be to allow non-writable arrays in `DataLoader`, but that is a PyTorch issue.
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
222
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. > To users it would not be clear at all what is going on e.g. when they check for write access (which will return True) but then they get a warning that the array is not writeable. That's extremely confusing. Confusion can be resolved with a helpful error message. In this case, that error message can be controlled by huggingface/datasets. The right argument here is that if code depends on `.flags.writable` being truthful (not just for warnings), then it will cause unavoidable errors. Although, I can't imagine such a use-case. > If your only goal is to get rid of warnings in your code, then you can just use a simplefilter for UserWarnings in your own code. Changing the code-base in such an intuitive way does not seem like a good way to go and sets a bad precedent, imo. I don't want to ignore all `UserWarnings`, nor all warnings regarding non-writable arrays. Ignoring warnings leads to hard to debug issues. > IMO a warning can stay (as they can be filtered by users anyway), but it can be clarified why the warning takes place. Plain use cases should really not generate warnings. It teaches developers to ignore warnings which is a terrible practice. --- The best solution would be to allow non-writable arrays in `DataLoader`, but that is a PyTorch issue.
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
> The right argument here is that if code depends on `.flags.writable` being truthful (not just for warnings), then it will cause unavoidable errors. Although, I can't imagine such a use-case. That's exactly the argument in my first sentence. Too often someone "cannot think of a use-case", but you can not foresee the use-cases of a whole research community. > I don't want to ignore all `UserWarnings`, nor all warnings regarding non-writable arrays. Ignoring warnings leads to hard to debug issues. That's fair. > Plain use cases should really not generate warnings. It teaches developers to ignore warnings which is a terrible practice. But this is not a plain use-case (because Pytorch does not support these read-only tensors). Manually setting the flag to writable will solve the issue on the surface but is basically just a hack to compensate for something that is not allowed in another library. What about an "ignore_warnings" flag in `set_format` that when True wraps the offending code in a block to ignore userwarnings at that specific step in [_convert_outputs](https://github.com/huggingface/datasets/blob/880c2c76a8223a00c303eab2909371e857113063/src/datasets/arrow_dataset.py#L821)? Something like: ```python def _convert_outputs(..., ignore_warnings=True): ... with warnings.catch_warnings(): if ignore_warnings: warnings.simplefilter("ignore", UserWarning) return torch.tensor(...) # continues without warning filter after context manager... ```
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
198
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. > The right argument here is that if code depends on `.flags.writable` being truthful (not just for warnings), then it will cause unavoidable errors. Although, I can't imagine such a use-case. That's exactly the argument in my first sentence. Too often someone "cannot think of a use-case", but you can not foresee the use-cases of a whole research community. > I don't want to ignore all `UserWarnings`, nor all warnings regarding non-writable arrays. Ignoring warnings leads to hard to debug issues. That's fair. > Plain use cases should really not generate warnings. It teaches developers to ignore warnings which is a terrible practice. But this is not a plain use-case (because Pytorch does not support these read-only tensors). Manually setting the flag to writable will solve the issue on the surface but is basically just a hack to compensate for something that is not allowed in another library. What about an "ignore_warnings" flag in `set_format` that when True wraps the offending code in a block to ignore userwarnings at that specific step in [_convert_outputs](https://github.com/huggingface/datasets/blob/880c2c76a8223a00c303eab2909371e857113063/src/datasets/arrow_dataset.py#L821)? Something like: ```python def _convert_outputs(..., ignore_warnings=True): ... with warnings.catch_warnings(): if ignore_warnings: warnings.simplefilter("ignore", UserWarning) return torch.tensor(...) # continues without warning filter after context manager... ```
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
> But this is not a plain use-case (because Pytorch does not support these read-only tensors). By "plain", I mean the recommended way to use `datasets` with PyTorch according to the `datasets` documentation.
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
33
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. > But this is not a plain use-case (because Pytorch does not support these read-only tensors). By "plain", I mean the recommended way to use `datasets` with PyTorch according to the `datasets` documentation.
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/616
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors
This error is what I see when I run the first lines of the Pytorch Quickstart. It should also say that it should be ignored and/or how to fix it. BTW, this is a Pytorch error message -- not a Huggingface error message. My code runs anyway.
I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List.
47
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors I am trying out the library and want to load in pickled data with `from_dict`. In that dict, one column `text` should be tokenized and the other (an embedding vector) should be retained. All other columns should be removed. When I eventually try to set the format for the columns with `set_format` I am getting this strange Userwarning without a stack trace: > Set __getitem__(key) output type to torch for ['input_ids', 'sembedding'] columns (when key is int or slice) and don't output other (un-formatted) columns. > C:\Users\bramv\.virtualenvs\dutch-simplification-nbNdqK9u\lib\site-packages\datasets\arrow_dataset.py:835: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:141.) > return torch.tensor(x, **format_kwargs) The first one might not be related to the warning, but it is odd that it is shown, too. It is unclear whether that is something that I should do or something that that the program is doing at that moment. Snippet: ``` dataset = Dataset.from_dict(torch.load("data/dummy.pt.pt")) print(dataset) tokenizer = AutoTokenizer.from_pretrained("bert-base-cased") keys_to_retain = {"input_ids", "sembedding"} dataset = dataset.map(lambda example: tokenizer(example["text"], padding='max_length'), batched=True) dataset.remove_columns_(set(dataset.column_names) - keys_to_retain) dataset.set_format(type="torch", columns=["input_ids", "sembedding"]) dataloader = torch.utils.data.DataLoader(dataset, batch_size=2) print(next(iter(dataloader))) ``` PS: the input type for `remove_columns_` should probably be an Iterable rather than just a List. This error is what I see when I run the first lines of the Pytorch Quickstart. It should also say that it should be ignored and/or how to fix it. BTW, this is a Pytorch error message -- not a Huggingface error message. My code runs anyway.
[ 0.238243863, -0.3691008389, 0.0651261508, 0.1298751533, 0.4380830824, 0.0913998485, 0.6286587119, 0.2343866974, 0.2976015806, 0.0604874305, -0.1968635321, 0.4237813354, -0.3091079891, -0.2186418474, -0.256572634, -0.207190901, -0.0199279841, 0.1609408259, 0.0264152531, -0.0268476531, -0.055612471, 0.03492295, -0.1734232306, 0.3379643559, -0.2255874574, -0.4098301232, 0.2081688493, -0.0633973852, -0.0799701363, -0.3318475187, 0.1405587941, -0.2741778195, -0.0424053855, 0.1276776195, -0.0001266726, 0.1157199517, 0.0211009253, -0.0969709456, -0.0743482634, -0.1103795469, 0.7791624069, -0.3006570041, 0.2598282993, -0.5041795969, -0.0403003134, -0.2053056955, -0.0674015209, -0.2887424529, 0.6341740489, 0.2032751888, 0.0752524808, 0.5057704449, 0.1049246266, 0.3881486058, -0.0660525039, 0.3452897966, -0.2550108731, -0.0293218978, 0.0295192953, 0.1392834336, -0.0000623714, 0.2642535865, -0.5914074779, 0.017145412, 0.1526442617, -0.0334383547, -0.3494707346, -0.1997035146, -0.0568564124, 0.443526119, 0.3706563413, -0.225417316, -0.0462097339, -0.3330505788, -0.1216260344, -0.1587675065, 0.1649686992, 0.047861632, -0.1130081564, 0.1626303643, 0.0142948497, -0.0069780736, -0.1369987428, 0.2631305158, 0.0543761253, 0.167330578, -0.1042311117, 0.3020679057, -0.0703179389, -0.0098414253, 0.0525530651, 0.0074247094, 0.1901579648, 0.1962173283, -0.1164150834, -0.311984241, -0.2599381208, -0.7474350333, -0.087094143, -0.2492240965, 0.3341349959, 0.2540559173, -0.1607192755, 0.0971489176, 0.1469385922, 0.0135783786, 0.1208701059, 0.3030396402, -0.0211056899, -0.2641310394, 0.4715952873, 0.0567321889, 0.1360289156, -0.2395031452, 0.0944851115, 0.0855745003, 0.0345737226, 0.0435556509, -0.4489811361, 0.1235724092, -0.2449784726, 0.0512569472, -0.0606113896, 0.0437431633, -0.0110613219, 0.0084556108, 0.080939889, 0.3331672847, -0.2172211111, 0.2093102783, 0.0050661592, 0.2291955799, -0.1825450659, -0.1943187267, -0.0641829818, 0.2339447141, 0.0189590268, 0.2614138424, 0.030292863, 0.0009380503, 0.123487927, -0.2359410673, 0.6530776024, 0.2942768931, -0.1781091094, 0.2948440015, 0.3621655107, -0.0307602417, -0.3972628713, 0.2834928632, -0.310448736, -0.2276653796, -0.5769515038, 0.002017468, -0.1900075376, 0.161483556, 0.1787661314, -0.255992204, 0.6716823578, -0.162664488, 0.4028993249, -0.4375565052, -0.0927186236, -0.3298017979, -0.0530221127, 0.3662084043, -0.3259871006, -0.0640388653, 0.2587724328, -0.0162683297, 0.433645606, 0.4094216228, -0.1056687161, 0.1454503238, -0.1220322102, 0.225503698, 0.3607752621, -0.1224518567, -0.0684339032, 0.1887914687, -0.1807032824, 0.3171918094, 0.1701439917, 0.0854642168, -0.1042876467, 0.1792415231, 0.2188507766, 0.0108662425, 0.3695320785, -0.0156878922, -0.3240775764, -0.2027051896, 0.483291924, -0.135716334, -0.0672295317, -0.1775232553, -0.1403663456, 0.0221996643, 0.3671857417, -0.1119876578, 0.0290920995, -0.041132655, -0.1673816442, 0.2396437675, -0.1404470205, 0.1050850227, -0.1710646003, -0.0152080487, 0.0745915696, 0.1085795313, -0.270911783, -0.1766558588, -0.1051724255, 0.0071569271, -0.3517927229, -0.0465409681, -0.1111047864, -0.1885499954, -0.113663815, 0.1317766756, -0.1785908192, -0.1946374029, -0.5005659461, 0.1517337263, -0.4120475054, -0.1020535082, -0.1012721807, -0.212443307, -0.3982956707, 0.3267837465, 0.2324444503, -0.0355699882, -0.0395299755, 0.0819810107, 0.232110396, -0.199763611, -0.917568922, 0.1638944447, 0.1763909757, -0.0909304321, 0.2472082824, 0.1546782404, -0.146642223, -0.096070908, -0.025754014, 0.6306299567, -0.0646009967, 0.0608095117, -0.5003481507, 0.2619295716, -0.1911874413, 0.1908106804, -0.1049911901, -0.4325117767, -0.0143133486, 0.1304034591, -0.2320647091, -0.0843060538, -0.4490360022, -0.1313849688, 0.059822686, 0.0488688909, 0.278139323, -0.0805686116, 0.1933734715, -0.2550162971, 0.2152754813, -0.5420800447, 0.1550078988, -0.1119839847, -0.0120685846, -0.0852294192, -0.1558956057, -0.2969710231, -0.0197966732, 0.0393946506, -0.0165406726, 0.1850436777, -0.0722502246, 0.1588743627, -0.3456684947, 0.1977576613, -0.1231662706, 0.0587115586, -0.4983722866, 0.2802629769, -0.1423192024, 0.0969331115, -0.2249715179, -0.2606524229, 0.026631061, -0.0663830712, -0.0077089095, 0.0847672224, -0.2427747995, 0.1668353379, -0.0719060302, 0.082257919, 0.1976009756, -0.1022717059, -0.0642503649, 0.0905627608, -0.0684161559, 0.021913968, -0.0892240331, -0.1524735838, 0.2516382635, -0.0162399914, -0.2449784428, -0.1003509462, -0.2109438181, 0.1382279396, -0.1868403554, -0.1263594031, 0.3529061079, 0.1456683427, -0.2808862925, -0.2442340702, -0.0112629356, -0.0327508077, 0.0331095606, 0.1553821117, 0.0217526928, 0.13360475, -0.0648510829, -0.1858778745, -0.4236636162, -0.0582786165, 0.1405144781, -0.1072302386, 0.4788046181, 0.2815491557, 0.2555831671, 0.15407902, -0.080394201, 0.2228562683, -0.2713087797, -0.0046550757, 0.3146923184, -0.1752707511, -0.1823734492, -0.2065905184, 0.1696431935, 0.0142173329, 0.0761995092, -0.3303350508, -0.1466786563, -0.0949351415, 0.1207671762, -0.2022127956, -0.1867319196, 0.2418568432, 0.228496477, 0.0300903879, 0.1885070354, 0.250055939, 0.0332655571, -0.2170521766, -0.0861482471, -0.0437797569, 0.1183456257, 0.2380001992, 0.461776197, -0.0420075171, -0.2846426368, 0.1601472497, 0.0010732752, 0.5781361461, -0.1647350043, -0.3022521138, 0.0216060914, 0.0767859295, 0.0009507095, -0.1333920211, -0.3836978972, -0.00015288, 0.2423483878, 0.0825091302, 0.1085123867, -0.2214958817, 0.4477954209, -0.3171698153, 0.0087407259, -0.1848476678, 0.7597174644, -0.1085421294, -0.2938229442, -0.1163829267, 0.2062700093, 0.2668505609, -0.0254098605, -0.4820899963, -0.334962219, -0.3202603459, 0.2719300687, 0.1470127702, 0.6929340363, -0.1348296404, -0.2319809943, 0.3621512949, 0.2398636341, 0.2768636644, 0.0184222367, -0.2167358994, 0.2924698889, 0.0791201741, -0.3491106331, -0.1140720099, -0.0095903138, 0.1074208617, -0.0088579869, 0.4121201038, -0.1308529675, -0.224253118, 0.1573224068, 0.188241452, -0.1615240127, 0.0613939986, -0.2136746198, -0.2623850405, -0.3775333166, 0.165260002, 0.2398947179, 0.2294294685, -0.2508633733, 0.0488717072, -0.0084931012, 0.2456669807, 0.3178787529, -0.0956500471, 0.152244851, 0.148353681, -0.3418128788, 0.3096509576, 0.3398796916, -0.0277443044, -0.1095984057, -0.1247119457, 0.1159105673, 0.1117185578, -0.0217785574, 0.2172193676, 0.4647899866, 0.1280824244, 0.4410917759, -0.1509371698, -0.109577693, -0.1212498695, 0.1708001494, 0.4047029316, -0.032860443, -0.3123684824, -0.4118335843, 0.259888202, 0.1042165086, -0.0633762777, 0.3375406265, -0.0369730555, -0.1301324069, 0.6268115044, 0.744335413, 1.2204276323, -0.2085443437, 0.5956699848, 0.327339083, -0.0674326941, 0.6187639236, -0.0102658803, 0.0424036272, -0.2683009505, 0.1548624039, -0.1980777532, -0.1577161551, 0.2015677989, -0.0019606422, -0.0411038473, -0.0536003746, -0.5109754801, 0.3334376216, 0.0068875425, 0.0026786006, -0.1011275351, -0.2555355132, 0.2363882959, -0.1040956527, -0.0791461691, 0.3209196329, -0.0350441225, 0.0317475386, 0.1873892397, -0.2768403292, -0.2541232407, -0.0294099227, 0.1044801772, 0.5604253411, 0.0119877411, -0.609201014, 0.2883667648, 0.4530896544, 0.3808435798, 0.1035280526, 0.0959939957, -0.1774270386, 0.2179634124, -0.3489565849, -0.048572354, -0.0852728859, 0.4823370874, 0.1212895587, -0.0862490386, 0.4521550238, -0.0263079703, -0.1532793343, -0.3243341148, 0.0973292664, 0.466035217, -0.656159699, -0.0559298173, -0.2054631412, 0.0001007345, -0.0621722676, -0.0448218919, 0.2190756351, 0.0646788403, 0.1037346795, -0.2519075274, -0.4340581298, -0.0367063284, 0.2222432941, 0.2893690765, -0.1179221943, 0.8795531988, 0.0664850324, -0.3234812617, -0.1874033362, 0.0371700265, 0.2153201997, -0.1092451662, -0.0018605257, 0.1581520289, -0.1175390556, -0.3384718597, 0.3617874682, 0.0083911289, 0.2841090262, -0.3869200945, -0.1965321302, -0.422475338, -0.0321238227, 0.277954042, 0.3617929816, 0.0696605891, 0.1996619254, -0.1247274801, -0.1013159528, -0.1560569853, -0.0752206296, 0.0202212259, 0.0376655981, 0.0879770666, -0.0319658183, -0.0273688678, -0.1754419208, -0.0822162405, 0.0666391104, -0.1285915226, -0.0146795539, -0.2238381505, 0.2570937276, 0.1262628287, -0.4150517881, -0.152778849, -0.2237046212, 0.0586873107, -0.157918185, 0.1590575874, 0.5828675628, 0.1063296199, 0.3782193065, -0.2470913529, 0.5658980012, -0.0748701319, -0.0877131596, -0.3030566871, 0.0571163706, -0.039043095, -0.0320370272, 0.0130812991, -0.0603504665, 0.0060969936, 0.1890246719, 0.2629615068, 0.0186590012, -0.005215351, -0.0120392246, -0.1070670113, -0.3753265738, -0.0517679602, 0.1893555671, -0.2479216456, -0.5765471458, 0.2642935812, 0.0123997377, 0.0169079304, 0.0137432888, -0.433645457, 0.0795570314, -0.0310481824, 0.1702328771, 0.0805720091, 0.1417364627, -0.0181905851, 0.0981456339, 0.2180116028, -0.3502318859, 0.1294846535, 0.4828864038, -0.2283922434, -0.0452727489, 0.4522113502, -0.0312916711, 0.2341945767, -0.1334192455, 0.0915353894, 0.4512061775, 0.1692261398, -0.0341868624, -0.3178963959, -0.3285260201, 0.1474930197, 0.237878263, 0.0970566794, 0.3567233384, 0.2927555442, 0.4019019902, -0.4451824129, -0.0209466927, 0.0176269691, 0.2360850573, -0.3745495379, -0.0451740287, -0.3808811605, 0.0096498821, 0.04849777, -0.1260534823, -0.1597314328, 0.0313257463, 0.0340275764, -0.0899488851, -0.2625426054, 0.1525455862, 0.2857147753, 0.0725884289, 0.1878761202, -0.2299560905, -0.1870910525, 0.0890278071, 0.1067849845, -0.0448152013, 0.037479043, 0.4447661638, 0.358741492, -0.1035054848, -0.0842833668, -0.1757003665, -0.0139694931, 0.1993030459, 0.4816289842, 0.0186823923, 0.0138759846, 0.2879363894, -0.0183103215, -0.0949820951, 0.0105207833, 0.2952635884, 0.2227563411, 0.1748557538, 0.3795817792, -0.0568387918, -0.4856648147, 0.003331379, -0.0617628284, -0.1641253233, 0.17174384, 0.3564148843, 0.214304015, 0.17977494, -0.1373206228, 0.0054708133, 0.3706023693, 0.4430558681, 0.2518372834, -0.0295525659, -0.3219551146, 0.335274756, -0.3268110752, 0.4080525339, -0.0225136727, -0.3146440685, -0.0225456096, -0.1043130681, 0.3645895123, 0.0440230519, -0.3006753623, 0.1305755079, -0.2481037676, 0.0429528132, -0.0048683309, 0.1862840354, 0.0995334834, -0.059490405, -0.0888573751, -0.3397576511, 0.4442161918, 0.1383633018, -0.0315220915, -0.4207598269, 0.1421374232, -0.2364390194, 0.2782036364, 0.3304498196, 0.1277319789, 0.4267581701, -0.0317621455, -0.1237798557, -0.0141851269, 0.0862122104, -0.1058099121, 0.2842885852, 0.2063486576, 0.2731182277, 0.0385230258, 0.0542451032, -0.2951191664, 0.5469297171, -0.1160322949, -0.3950824738, -0.0497784726, 0.2726546824, -0.2424454838, -0.1353645921, 0.0816413909, 0.2359434813, 0.3239525557, 0.2044598609, -0.3263272047, -0.3508826196, 0.5388799906, -0.3649679124, -0.1342417449, -0.1359104365, 0.0869564041, 0.3645113111, 0.1180237085, -0.7096750736, -0.0097282752, 0.2363466024, -0.1331494153, -0.040949706, -0.1120021641, -0.1369573027, -0.1903095096, -0.2534230351, 0.660825491, -0.0571326129, -0.0422458611, -0.1349737793, -0.3494077921 ]
https://github.com/huggingface/datasets/issues/615
Offset overflow when slicing a big dataset with an array of indices in Pyarrow >= 1.0.0
Related: https://issues.apache.org/jira/browse/ARROW-9773 It's definitely a size thing. I took a smaller dataset with 87000 rows and did: ``` for i in range(10,1000,20): table = pa.concat_tables([dset._data]*i) table.take([0]) ``` and it broke at around i=300. Also when `_indices` is not None, this breaks indexing by slice. E.g. `dset.shuffle()[:1]` breaks. Luckily so far I haven't seen `_indices.column(0).take` break, which means it doesn't break `select` or anything like that which is where the speed really matters, it's just `_getitem`. So I'm currently working around it by just doing the arrow v0 method in `_getitem`: ``` #if PYARROW_V0: data_subset = pa.concat_tables( self._data.slice(indices_array[i].as_py(), 1) for i in range(len(indices_array)) ) #else: #data_subset = self._data.take(indices_array) ```
How to reproduce: ```python from datasets import load_dataset wiki = load_dataset("wikipedia", "20200501.en", split="train") wiki[[0]] --------------------------------------------------------------------------- ArrowInvalid Traceback (most recent call last) <ipython-input-13-381aedc9811b> in <module> ----> 1 wikipedia[[0]] ~/Desktop/hf/nlp/src/datasets/arrow_dataset.py in __getitem__(self, key) 1069 format_columns=self._format_columns, 1070 output_all_columns=self._output_all_columns, -> 1071 format_kwargs=self._format_kwargs, 1072 ) 1073 ~/Desktop/hf/nlp/src/datasets/arrow_dataset.py in _getitem(self, key, format_type, format_columns, output_all_columns, format_kwargs) 1037 ) 1038 else: -> 1039 data_subset = self._data.take(indices_array) 1040 1041 if format_type is not None: ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/table.pxi in pyarrow.lib.Table.take() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/compute.py in take(data, indices, boundscheck) 266 """ 267 options = TakeOptions(boundscheck) --> 268 return call_function('take', [data, indices], options) 269 270 ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/_compute.pyx in pyarrow._compute.call_function() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/_compute.pyx in pyarrow._compute.Function.call() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status() ArrowInvalid: offset overflow while concatenating arrays ``` It seems to work fine with small datasets or with pyarrow 0.17.1
108
Offset overflow when slicing a big dataset with an array of indices in Pyarrow >= 1.0.0 How to reproduce: ```python from datasets import load_dataset wiki = load_dataset("wikipedia", "20200501.en", split="train") wiki[[0]] --------------------------------------------------------------------------- ArrowInvalid Traceback (most recent call last) <ipython-input-13-381aedc9811b> in <module> ----> 1 wikipedia[[0]] ~/Desktop/hf/nlp/src/datasets/arrow_dataset.py in __getitem__(self, key) 1069 format_columns=self._format_columns, 1070 output_all_columns=self._output_all_columns, -> 1071 format_kwargs=self._format_kwargs, 1072 ) 1073 ~/Desktop/hf/nlp/src/datasets/arrow_dataset.py in _getitem(self, key, format_type, format_columns, output_all_columns, format_kwargs) 1037 ) 1038 else: -> 1039 data_subset = self._data.take(indices_array) 1040 1041 if format_type is not None: ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/table.pxi in pyarrow.lib.Table.take() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/compute.py in take(data, indices, boundscheck) 266 """ 267 options = TakeOptions(boundscheck) --> 268 return call_function('take', [data, indices], options) 269 270 ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/_compute.pyx in pyarrow._compute.call_function() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/_compute.pyx in pyarrow._compute.Function.call() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() ~/.virtualenvs/hf-datasets/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status() ArrowInvalid: offset overflow while concatenating arrays ``` It seems to work fine with small datasets or with pyarrow 0.17.1 Related: https://issues.apache.org/jira/browse/ARROW-9773 It's definitely a size thing. I took a smaller dataset with 87000 rows and did: ``` for i in range(10,1000,20): table = pa.concat_tables([dset._data]*i) table.take([0]) ``` and it broke at around i=300. Also when `_indices` is not None, this breaks indexing by slice. E.g. `dset.shuffle()[:1]` breaks. Luckily so far I haven't seen `_indices.column(0).take` break, which means it doesn't break `select` or anything like that which is where the speed really matters, it's just `_getitem`. So I'm currently working around it by just doing the arrow v0 method in `_getitem`: ``` #if PYARROW_V0: data_subset = pa.concat_tables( self._data.slice(indices_array[i].as_py(), 1) for i in range(len(indices_array)) ) #else: #data_subset = self._data.take(indices_array) ```
[ -0.3078597486, -0.162481457, -0.0384138711, 0.1917552948, 0.1244792864, -0.0056269197, 0.2420148104, 0.1383451521, -0.3982104659, 0.361923784, 0.3079871535, 0.4601459205, 0.0280527472, 0.0383536592, 0.0241384134, -0.088973321, -0.0426646136, 0.060955327, -0.1887905449, -0.0936410725, -0.0416766368, -0.3072256744, -0.2502088547, -0.0529376231, -0.1218302026, -0.2309740484, 0.1539250612, 0.1009822562, -0.1768928021, -0.202406615, 0.3342114389, -0.267154336, 0.0081015239, -0.0058168527, -0.0001175907, 0.1050931215, 0.350769192, 0.026984876, -0.0879453868, 0.3618623912, -0.1608603299, -0.3452382982, 0.049474325, -0.4793947935, 0.2600329518, -0.1769218594, -0.207745567, 0.067609258, 0.0854018331, 0.2236689478, 0.1557556242, -0.0401190445, 0.1585735679, 0.2635316551, 0.32635355, 0.023410568, -0.0072754542, -0.2422340065, -0.1678851396, 0.0705335513, -0.2242979407, -0.0016123464, -0.0947054103, -0.0284250099, 0.0539903976, 0.0067401771, -0.0233416781, 0.0207043886, -0.1426186413, 0.0567588359, 0.2461705655, -0.2803450823, -0.1456433535, -0.2259113789, -0.0329126231, -0.3547536433, 0.1401233375, 0.3031682968, -0.0155507904, 0.033987768, -0.2461454868, 0.2101864815, -0.2522285879, 0.2505633533, -0.1889609694, 0.269826889, 0.1512382329, 0.1663445681, 0.1357588768, -0.1141220778, 0.4339351058, -0.1705890745, -0.0047744745, 0.169642508, -0.2869723141, 0.1074187234, 0.1948892027, -0.1316959709, 0.5008722544, -0.3496705592, 0.0059448583, 0.0440779552, 0.2339589745, 0.0869399235, 0.2841059566, 0.1922838688, -0.5885925293, 0.177975297, -0.0207448471, 0.0505629778, 0.014646261, 0.0611451864, 0.200725019, -0.1749117374, 0.3466880322, -0.0800634399, 0.0683383942, -0.1202837601, -0.290332675, 0.1888432205, -0.4950129986, 0.3146744668, 0.2096388936, -0.0979565084, 0.0071370918, -0.0668993667, -0.2257012278, 0.0162176695, -0.2137298286, 0.0277417917, -0.1721849442, -0.0789438263, -0.0978925899, -0.1193297431, 0.0237432942, 0.1679455638, -0.0813869908, 0.3148365915, 0.3989405334, -0.1049106345, -0.1097597778, -0.1568695605, 0.4402475953, 0.2657411695, -0.0372490697, 0.0719270557, -0.1062023118, 0.0841025114, -0.0842689797, 0.5176150203, -0.2612576485, -0.3617992997, -0.1042303592, 0.17216447, -0.1236085892, 0.1671471596, -0.2392049581, 0.1035818011, 0.2674864233, -0.060545031, 0.1868404299, -0.1679097861, -0.0465433747, -0.1870519668, 0.2324188203, 0.0651651919, -0.5403258801, 0.3515722454, 0.0464573316, 0.2777179778, 0.3522079587, 0.5056605339, -0.3103645444, -0.0813854188, -0.2419675142, 0.0542321578, 0.1743370444, 0.0021218315, -0.8825096488, -0.0902405754, -0.1311735511, -0.0398752466, 0.2627775967, -0.1125267819, 0.2651939988, 0.0228160154, -0.0259932186, 0.4810883701, -0.2747822404, 0.2685477734, -0.4711419046, -0.1202222183, 0.0109111378, 0.0561426878, 0.0007092542, -0.4467769265, -0.0522028245, -0.2801514566, 0.2582903802, 0.048017513, 0.2383668572, 0.2446468323, 0.0595670044, -0.2582809031, 0.1781595498, -0.2147066295, -0.0670892, -0.0253212992, -0.0054617124, -0.0934446156, -0.3762579858, -0.2153982967, -0.1107434854, 0.3079875708, -0.1378662139, 0.2697454393, 0.1490945816, -0.3101870418, 0.3051524162, 0.1536783874, 0.1448461413, -0.1100103781, -0.1788466275, -0.0944765806, -0.2770964205, 0.3967709243, -0.1217573136, -0.3430443406, -0.0394436792, 0.3696361184, 0.1240581349, -0.1210042313, -0.0816151351, 0.2475918829, 0.1220878288, -0.1240402684, -0.1544878781, 0.2013613582, 0.1901599616, -0.669038415, 0.1178058535, -0.0190326944, -0.0259278119, 0.0730738938, -0.2147432417, 0.3537634909, -0.3796565831, 0.1163660288, -0.0941118449, -0.030895073, 0.1070782542, -0.0249293409, 0.1990388483, -0.0057954369, -0.1353927255, 0.2408870012, -0.0255298987, -0.0582759529, 0.0853513405, 0.2082443535, 0.4890705943, -0.1404571235, -0.0235349331, 0.0426871181, -0.2933746874, -0.0679954663, 0.1969689727, -0.2779557705, -0.0518843047, 0.440805465, 0.0995411575, -0.2342007607, -0.0678509325, -0.1258073002, 0.2366425544, 0.3833582401, 0.0870452747, 0.1480712593, 0.4960046113, -0.1378154457, -0.367536068, 0.0245736651, 0.2212058455, 0.4458928704, -0.1369951665, 0.364135325, -0.1575202048, -0.2291458249, -0.15399611, -0.5479344726, -0.0495437905, -0.5558484793, -0.1171551049, 0.2539519668, -0.222250089, 0.31766361, 0.0286698714, -0.0788913965, 0.4207019508, -0.2142771184, -0.01346514, -0.2432038188, -0.1864147186, 0.0226917136, 0.3362286091, 0.0649513379, 0.0128789395, 0.4299612045, 0.097650744, -0.009256714, -0.3197995126, 0.0494461916, 0.1751479208, 0.2215362191, 0.0291961897, -0.2809970081, -0.3562774062, -0.2338239402, -0.0001734696, 0.1419411153, -0.1411356777, 0.4679219723, -0.1558836848, 0.0448505357, 0.0084005417, -0.0066717393, -0.0028690174, -0.3170768619, -0.1068455353, -0.0941458046, 0.146625489, 0.1291238815, 0.2173156142, 0.0217558239, 0.1971847117, -0.3625347614, -0.2118216753, 0.0719036385, 0.3074546158, -0.0073135039, -0.1995084733, -0.1844009459, -0.468821913, -0.1206628084, 0.312115252, -0.4352706373, 0.1149597988, -0.1654763967, 0.5477545261, -0.4002650678, 0.0760844871, 0.1913096458, 0.1314124465, -0.075461641, -0.179487139, -0.0041372594, 0.0360307507, -0.1388115287, -0.0993698761, -0.0103418408, 0.3555847704, 0.1919983029, 0.6874068975, 0.1828755587, -0.0826882422, 0.1499191523, -0.1037696674, 0.0607792549, -0.0972276032, -0.2453378141, 0.1346121728, 0.275949657, -0.2638721466, 0.0069093853, -0.0608502552, -0.3277966678, 0.3485787511, -0.181895718, -0.1257544905, -0.3210378289, 0.2611427009, -0.1045737416, 0.0411944836, 0.1294794381, -0.1142402291, -0.1942570955, -0.2883713543, 0.0373693593, -0.1895453036, 0.2498662472, -0.12958166, 0.0257856846, -0.1655410677, -0.1086155251, 0.0432141125, 0.253586024, 0.1290031523, 0.2761617005, -0.077462323, 0.2144341916, -0.0877564028, 1.0529714823, 0.1035219282, 0.0862726122, -0.0843410119, 0.3270575404, -0.5469655395, 0.0455025956, -0.3395442069, 0.4172219932, 0.1493500024, 0.0795405209, -0.2137518674, 0.1312848479, 0.6030220985, 0.2673248947, -0.0757202953, -0.187387377, -0.1004453525, -0.1217113882, 0.2724305689, 0.3786857128, 0.0342793949, 0.3319783807, 0.0867868811, -0.2884067297, -0.4074477255, -0.1794431061, -0.4362610877, 0.0392235816, 0.3683808744, -0.2323276699, 0.0919801742, -0.2026364207, -0.1233668625, 0.587459743, 0.2761704624, 0.1106541753, -0.1481909305, -0.1145761162, 0.1147042215, 0.296894908, -0.1863586605, 0.0224657543, -0.0042994055, -0.0667000785, 0.2870541513, -0.0751793012, -0.2727068961, -0.0565403998, 0.0645266697, -0.0863801986, 0.0467157178, 0.5351300836, -0.0962857082, -0.0200151429, 0.2606786191, 0.4524256885, -0.2280533463, 0.2177148014, 0.2168308794, 0.6593001485, -0.0582125671, -0.0079516266, 0.3936108351, 0.0186924413, 0.3969328105, 0.1132596061, 0.2290650308, -0.263315767, -0.2673662007, 0.168332994, -0.2955302, -0.2516089976, 0.0523137115, -0.1367735714, 0.0307244193, -0.1729727238, 0.0640648454, -0.1427881271, -0.0798085406, 0.1897867173, -0.2027527094, -0.3587450981, 0.0043284767, 0.0839710459, -0.4553227723, -0.0062029692, -0.0558737628, -0.072732769, -0.0626005605, -0.2099881619, -0.0158434212, -0.3024450839, 0.2118617147, 0.1587903053, -0.669341445, 0.0959843621, -0.1027469337, -0.0909661353, -0.0037840353, 0.0125187673, -0.0979867056, 0.0787515193, -0.1514407098, -0.093180716, 0.1588275284, 0.3725362122, 0.1117563248, -0.3891113698, 0.0792201683, 0.1022789851, -0.0605835244, 0.091654487, 0.1698604971, 0.1858794391, -0.3513029516, 0.0801831707, -0.2744288743, -0.0276285578, -0.2533025742, 0.0510551631, -0.0321577154, -0.3189629912, 0.3559044302, 0.1106920987, -0.1777251065, -0.0625040978, 0.3362925947, 0.1386840343, 0.306922406, 0.4120991826, 0.2120610029, -0.2112432867, -0.0923747718, 0.2197965831, 0.2482066154, -0.2466108203, -0.1335741132, -0.3357232213, 0.2979921103, 0.0040589948, -0.1968060136, 0.0943774506, 0.2139055729, -0.476534456, -0.2514710426, -0.2843225598, 0.2115408927, 0.0218785703, -0.1386731863, 0.1883490384, -0.1097697243, -0.1664047986, 0.0380353145, -0.2583704889, 0.2426105142, 0.0158910528, 0.2187197357, -0.2371934503, -0.1162921712, 0.0712877586, -0.1096850112, 0.0967871472, 0.0323480256, -0.084899798, -0.2896193564, -0.0747359619, 0.06877473, 0.1048449427, -0.2686827183, -0.1610887498, -0.0881016552, -0.1971554905, -0.0708957687, 0.1996875852, -0.0409921631, -0.003010801, 0.0278006159, 0.6172448993, -0.2400881797, -0.4222011268, -0.0536633208, -0.0288903657, 0.1443917304, 0.1050766483, 0.5081797838, 0.0785974562, -0.0513163917, -0.1385729611, 0.0988984704, 0.0796134919, -0.0999371186, 0.4434024096, -0.3727134168, -0.2157140821, 0.2484066337, 0.3717080653, 0.2496130615, -0.0126266591, -0.3776682317, 0.1215233728, 0.2283975929, -0.0320639275, -0.2781694829, 0.1422369629, 0.1158114895, 0.1839357018, 0.3635496497, -0.045644898, -0.3120149374, 0.0750239491, 0.0862321928, 0.5116411448, -0.0492973216, -0.2612500191, 0.5733863115, -0.1759340763, -0.2163205296, 0.3265041709, -0.0425852314, 0.5641286969, 0.6425900459, -0.0141265169, 0.296748966, 0.2060592026, -0.3082505465, -0.060401611, -0.126505658, -0.288438648, 0.2563357949, -0.0069088889, 0.1854425371, 0.1793783754, 0.2107780129, 0.4293077886, 0.0859495774, 0.0137429768, -0.0070638531, -0.2963064909, 0.0951605812, -0.3648279607, -0.0339969024, 0.1075608134, -0.0892927051, -0.0629896522, 0.1336777806, 0.5363904834, 0.0736942217, 0.0753086582, -0.1682991236, 0.4725376368, 0.3535589576, 0.2539382279, -0.1741780192, 0.3685828447, 0.3450316191, 0.0600092858, -0.3759498, 0.2836776376, 0.4476298392, 0.0661306456, -0.2917459011, -0.1754904836, 0.1431082189, -0.1993092448, -0.3571978211, 0.0562640391, -0.0223260559, 0.2697278857, 0.160120219, 0.1058420315, -0.1833209693, 0.0344819427, 0.5079105496, -0.0918381736, -0.1485919952, -0.3756018877, -0.0136665236, -0.4743430614, 0.070335336, -0.0579416491, 0.0409055091, 0.0677908882, 0.1807414591, -0.0876701996, 0.0531847961, 0.2307293117, 0.0352969281, -0.380838871, 0.7067386508, 0.5049712658, 0.2196251601, -0.2470972687, 0.0792751014, 0.017503636, 0.4386531711, -0.2930750549, -0.0511545166, 0.509876132, 0.3039680421, -0.178064242, 0.2502113581, 0.1689564139, 0.1316727549, -0.1954149306, 0.4371806681, -0.5424676538, -0.2461663783, 0.0678666234, -0.4354547262, -0.1111011356, -0.4641907215, 0.2038557678, -0.0356637165, 0.0513347201, -0.0334169939, 0.2375264317, -0.1416109353, 0.112138547, 0.2387250811, 0.4911786616, 0.1525253654, 0.0015406129, 0.1109363809, -0.1395283192, -0.1394061446, -0.5160040855, 0.562758863, -0.1268525422, 0.2740683258, -0.1731085628, -0.718791008, 0.1381966621, 0.14208588, 0.1563245505, 0.0118766529, 0.0317551792, 0.1862272173, -0.2070298791, 0.0572314262, -0.0017846527, 0.0907567963, 0.1579874456, 0.2495680153, -0.0379337929, -0.2104880214, 0.1006880999, -0.2144785374, -0.1678660959, -0.0442157239, 0.1772097945, 0.228009522, -0.3719460368, -0.2544881403, 0.0146529265, 0.4591274261, -0.1570972502, -0.1533430517, 0.1323523372, 0.1654483378, 0.0945472792, 0.0275234096, 0.2726257741, 0.0628592074, -0.3466642201, -0.0776625872, -0.2243149132 ]
https://github.com/huggingface/datasets/issues/611
ArrowCapacityError: List array cannot contain more than 2147483646 child elements, have 2147483648
``` <class 'pandas.core.frame.DataFrame'> Int64Index: 17136104 entries, 0 to 17136103 Data columns (total 6 columns): # Column Dtype --- ------ ----- 0 item_id int64 1 item_titl object 2 start_price float64 3 shipping_fee float64 4 picture_url object 5 embeddings object dtypes: float64(2), int64(1), object(3) memory usage: 915.2+ MB ```
Hi, I'm trying to load a dataset from Dataframe, but I get the error: ```bash --------------------------------------------------------------------------- ArrowCapacityError Traceback (most recent call last) <ipython-input-7-146b6b495963> in <module> ----> 1 dataset = Dataset.from_pandas(emb) ~/miniconda3/envs/dev/lib/python3.7/site-packages/nlp/arrow_dataset.py in from_pandas(cls, df, features, info, split) 223 info.features = features 224 pa_table: pa.Table = pa.Table.from_pandas( --> 225 df=df, schema=pa.schema(features.type) if features is not None else None 226 ) 227 return cls(pa_table, info=info, split=split) ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/table.pxi in pyarrow.lib.Table.from_pandas() ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/pandas_compat.py in dataframe_to_arrays(df, schema, preserve_index, nthreads, columns, safe) 591 for i, maybe_fut in enumerate(arrays): 592 if isinstance(maybe_fut, futures.Future): --> 593 arrays[i] = maybe_fut.result() 594 595 types = [x.type for x in arrays] ~/miniconda3/envs/dev/lib/python3.7/concurrent/futures/_base.py in result(self, timeout) 426 raise CancelledError() 427 elif self._state == FINISHED: --> 428 return self.__get_result() 429 430 self._condition.wait(timeout) ~/miniconda3/envs/dev/lib/python3.7/concurrent/futures/_base.py in __get_result(self) 382 def __get_result(self): 383 if self._exception: --> 384 raise self._exception 385 else: 386 return self._result ~/miniconda3/envs/dev/lib/python3.7/concurrent/futures/thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc) ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/pandas_compat.py in convert_column(col, field) 557 558 try: --> 559 result = pa.array(col, type=type_, from_pandas=True, safe=safe) 560 except (pa.ArrowInvalid, 561 pa.ArrowNotImplementedError, ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib.array() ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib._ndarray_to_array() ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status() ArrowCapacityError: List array cannot contain more than 2147483646 child elements, have 2147483648 ``` My code is : ```python from nlp import Dataset dataset = Dataset.from_pandas(emb) ```
47
ArrowCapacityError: List array cannot contain more than 2147483646 child elements, have 2147483648 Hi, I'm trying to load a dataset from Dataframe, but I get the error: ```bash --------------------------------------------------------------------------- ArrowCapacityError Traceback (most recent call last) <ipython-input-7-146b6b495963> in <module> ----> 1 dataset = Dataset.from_pandas(emb) ~/miniconda3/envs/dev/lib/python3.7/site-packages/nlp/arrow_dataset.py in from_pandas(cls, df, features, info, split) 223 info.features = features 224 pa_table: pa.Table = pa.Table.from_pandas( --> 225 df=df, schema=pa.schema(features.type) if features is not None else None 226 ) 227 return cls(pa_table, info=info, split=split) ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/table.pxi in pyarrow.lib.Table.from_pandas() ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/pandas_compat.py in dataframe_to_arrays(df, schema, preserve_index, nthreads, columns, safe) 591 for i, maybe_fut in enumerate(arrays): 592 if isinstance(maybe_fut, futures.Future): --> 593 arrays[i] = maybe_fut.result() 594 595 types = [x.type for x in arrays] ~/miniconda3/envs/dev/lib/python3.7/concurrent/futures/_base.py in result(self, timeout) 426 raise CancelledError() 427 elif self._state == FINISHED: --> 428 return self.__get_result() 429 430 self._condition.wait(timeout) ~/miniconda3/envs/dev/lib/python3.7/concurrent/futures/_base.py in __get_result(self) 382 def __get_result(self): 383 if self._exception: --> 384 raise self._exception 385 else: 386 return self._result ~/miniconda3/envs/dev/lib/python3.7/concurrent/futures/thread.py in run(self) 55 56 try: ---> 57 result = self.fn(*self.args, **self.kwargs) 58 except BaseException as exc: 59 self.future.set_exception(exc) ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/pandas_compat.py in convert_column(col, field) 557 558 try: --> 559 result = pa.array(col, type=type_, from_pandas=True, safe=safe) 560 except (pa.ArrowInvalid, 561 pa.ArrowNotImplementedError, ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib.array() ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/array.pxi in pyarrow.lib._ndarray_to_array() ~/miniconda3/envs/dev/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status() ArrowCapacityError: List array cannot contain more than 2147483646 child elements, have 2147483648 ``` My code is : ```python from nlp import Dataset dataset = Dataset.from_pandas(emb) ``` ``` <class 'pandas.core.frame.DataFrame'> Int64Index: 17136104 entries, 0 to 17136103 Data columns (total 6 columns): # Column Dtype --- ------ ----- 0 item_id int64 1 item_titl object 2 start_price float64 3 shipping_fee float64 4 picture_url object 5 embeddings object dtypes: float64(2), int64(1), object(3) memory usage: 915.2+ MB ```
[ -0.2813220918, -0.0744088963, -0.2195497453, 0.4159465432, 0.2823321819, -0.0299139991, 0.4081524312, 0.211316064, 0.3901509643, 0.0474444032, 0.0003714644, 0.3082345128, -0.086982362, 0.0685478151, 0.000835738, -0.3419587016, -0.0933910981, 0.227939263, -0.2755077481, 0.0938670933, -0.226255402, 0.0042208857, -0.2458189577, 0.2069006115, -0.0991635844, -0.16391702, 0.0946853906, -0.0185281523, -0.0302411653, -0.4899123907, 0.3556727171, -0.2945441902, 0.0409600101, 0.1827442944, -0.0001102196, 0.0405713543, 0.3709663153, 0.0665661097, -0.2005660832, -0.1553708464, -0.3287509382, -0.4413966835, 0.4300812781, -0.0768523067, 0.2361876965, -0.2503993809, -0.2843056321, -0.3228808343, 0.3386785388, 0.0333642289, 0.2106782049, 0.202707693, 0.4377658665, 0.1210990474, 0.0229466986, -0.0303457994, -0.1591519266, 0.4214888215, 0.1034793779, -0.2736415565, -0.0080703283, 0.0098079937, -0.1424648315, 0.3750423193, 0.1488453299, -0.0841918513, -0.1104781106, -0.3776777387, -0.2088727355, 0.2992430329, 0.6146754622, -0.2124875784, -0.3339964449, -0.0728104115, -0.0512902997, -0.3944199383, 0.0467975214, 0.2284300923, -0.0249726437, 0.0557535067, 0.0425888784, 0.06932199, -0.2296036929, 0.0915905163, -0.0219257902, 0.1695370823, -0.1137779653, 0.2228227109, 0.3527331352, -0.1476605684, 0.183055222, 0.1812525839, 0.0453064181, 0.1507355124, -0.4711747766, -0.0076135364, -0.2046746761, -0.4235938787, 0.018776292, 0.3424942791, 0.2327033877, 0.0266379043, 0.0264478307, 0.2103407234, 0.1510000676, 0.0093806405, -0.15168567, 0.0805708915, -0.21879749, -0.002609628, 0.1261629015, -0.0250723921, -0.0848935023, -0.1750029027, 0.1665084213, -0.1399340034, 0.3136581182, -0.1227992028, -0.4663729668, 0.2898982465, -0.4942125678, -0.1571939737, 0.1066770926, 0.194133237, 0.1898522228, 0.3169755936, -0.0033453023, 0.171369195, -0.0771827251, 0.158616364, -0.1784182787, 0.2248278707, 0.0160620362, 0.1040191874, -0.0073824343, 0.0587323047, 0.1619344652, 0.1394264698, 0.322509259, -0.1406375319, 0.2424960583, -0.4746845067, -0.049196437, 0.4604406953, -0.0665068626, 0.1373984069, 0.4816636443, 0.066106759, -0.0525115207, 0.2874203026, -0.0509188324, -0.1669091135, -0.3079308271, 0.20349738, 0.0864146203, 0.1019394398, -0.5072075725, -0.1107441336, 0.2790834904, 0.0325419344, 0.205215618, -0.1718201488, -0.0322396606, -0.2370042503, -0.0113935992, 0.2493874431, -0.6265670061, 0.1540755033, -0.009744972, -0.0042508389, 0.2222196907, 0.3802009821, -0.3712418675, 0.0840108842, -0.1422456056, 0.1392559856, -0.0864755735, 0.0490295775, -0.4882146716, 0.1294535697, 0.0305430647, -0.0098827761, 0.1360375285, 0.1243115142, 0.016461648, 0.0188370012, -0.0198178105, 0.2659703791, 0.1596461982, -0.1190211251, -0.0785413831, -0.091974318, 0.1880331486, 0.0425337516, -0.1309633106, -0.111163877, -0.0377985165, -0.0583447553, 0.0506681502, -0.0628659576, -0.1312289983, 0.3077426851, 0.1022798344, 0.0275660791, -0.1993939131, -0.1144554317, -0.2583918869, -0.002833999, 0.0060148821, -0.2196476907, -0.3686646819, 0.0322348364, -0.3015363812, 0.4142713249, -0.003701315, 0.146763429, 0.1555082351, 0.0351497568, -0.1392640173, -0.3405444324, -0.1125306562, 0.3829866052, -0.2520795166, 0.1174002886, -0.2488703281, 0.6389964223, -0.1225097328, -0.2358953506, 0.1020294428, -0.0589136146, 0.0078240205, -0.0617901757, -0.0541578829, 0.3003414571, 0.2589099407, -0.0539923385, -0.1232170835, -0.1712928116, 0.1711662114, -0.4476628304, -0.0194849931, 0.3259800971, 0.2496614307, 0.0040197913, 0.2005787492, 0.2582696974, -0.230536297, 0.1718456596, 0.0606855527, 0.0135373389, 0.2570948303, 0.2372243702, -0.0010138353, -0.100251846, -0.0585768446, 0.1710235626, 0.2922351956, 0.0836870521, -0.3078922927, -0.0896602422, 0.0380945206, 0.077954866, 0.1145799533, 0.1024588719, -0.101138778, -0.1450705528, 0.2871288359, -0.1594509184, 0.3604678512, 0.2623210251, -0.3645986021, -0.3160842061, -0.1206735447, 0.0692810342, 0.3395499587, 0.240805611, 0.4563711286, -0.0912681818, 0.0961697847, -0.0320503861, -0.2791268229, -0.5238829851, 0.0624613315, 0.4196494818, -0.3285615146, 0.2295598686, -0.1541729867, -0.1055465788, 0.2673347592, -0.6564481258, 0.0172791705, -0.145900771, -0.3326732516, 0.311335206, 0.0069781798, 0.0980788693, -0.3459626734, -0.1520459652, 0.3765096664, 0.0735320523, 0.0101609947, -0.0400557816, 0.1425978243, 0.1107219905, 0.2702673376, 0.0741864964, 0.2685506344, 0.3350818157, 0.005436582, -0.1947276592, -0.0174661558, -0.0798839852, -0.1669341922, 0.0517799444, 0.0623224117, 0.3742075861, -0.5855017304, -0.599920392, 0.1264113784, 0.0736579522, -0.1970531642, 0.1744910628, 0.0701364875, 0.1771167517, 0.1904891878, -0.1944369376, -0.3144044578, -0.3713177741, 0.1869551688, 0.2236396372, 0.3277162313, 0.3159983754, 0.2656183839, 0.123975493, 0.2631949782, -0.105783321, -0.1982410848, 0.1272567213, 0.1754867136, 0.0087332493, -0.2702607512, -0.1913998723, -0.2674704194, 0.2551690936, 0.0270456821, -0.3893485367, -0.2998655736, -0.3612285256, -0.0803877935, -0.3379430771, -0.0242437106, 0.2704577744, 0.140274927, -0.2321832925, 0.0587793887, -0.1001929194, -0.0318208523, -0.1266248822, 0.1443424821, -0.1426801831, 0.5946797729, -0.1982652992, 0.5423551202, 0.1506070346, -0.0378132612, 0.4440321624, -0.0917441174, 0.1699853837, -0.3620952368, -0.4971082807, -0.0669030845, -0.1251888871, 0.0664185882, -0.1115147769, -0.2821609676, -0.1304080784, 0.1161027253, -0.0095338635, -0.1359714568, 0.0811218247, 0.1733744591, -0.026082458, 0.1395893395, -0.1173080355, -0.0486917682, -0.1003914922, -0.0609221384, -0.2855704129, -0.2101401836, 0.2482717186, -0.1466302425, -0.2170103192, -0.2675656676, -0.0345852487, 0.3139542937, 0.3056479394, 0.5451369882, 0.1436628699, -0.0632694587, 0.0515470542, 0.049017109, 0.3031837046, 0.1406438947, -0.2015921324, 0.2815240622, -0.1118087396, -0.5275210142, 0.006812213, -0.2888289988, 0.2861068249, -0.1511151791, -0.1364952922, -0.2830282152, -0.0095330216, 0.1217482835, 0.3055149615, -0.0608975701, -0.1197311059, -0.3016714454, -0.0870331004, -0.5179739594, 0.1697144061, 0.1463098824, 0.2763126493, 0.0918484405, -0.2823676467, -0.2318425179, -0.5319343805, 0.0363813452, 0.0667780638, 0.3335452676, 0.1646633595, 0.1819220483, -0.2661643922, -0.1176078022, 0.5514035821, 0.3901547492, 0.2355771512, -0.0744234473, -0.0169188548, 0.0978518203, 0.2250103503, 0.0370265245, -0.0905063897, 0.1164838672, -0.2906730473, 0.1484723389, 0.1189410388, -0.0457756706, 0.0468275845, -0.0387608707, -0.2239280045, -0.2735213339, 0.4360410869, 0.0355576873, 0.1602489054, 0.4475949109, 0.2731460631, -0.0146160796, 0.1969363242, 0.2358178794, 0.8210716844, -0.322298646, 0.0012437861, 0.384711504, 0.0425250269, 0.4504194856, 0.3941971362, 0.1207176521, -0.3513602614, -0.2400814444, -0.1093839258, -0.2209489346, 0.1930113435, 0.1323994696, -0.2190536857, 0.1336611509, -0.1972191483, 0.1078306586, 0.0800064281, 0.0967846662, -0.0671037808, -0.3313190639, -0.5120386481, 0.1155117825, -0.2454331368, -0.184278965, -0.1543577313, -0.085488826, -0.0121683301, -0.0684573352, -0.1600125432, 0.1471407413, -0.2108899206, 0.5190976262, 0.2066062838, -0.5216557384, 0.0591062941, -0.0817664117, -0.2114799917, -0.0654449314, 0.0227800831, -0.1752674282, -0.1868133545, -0.2421341836, -0.1483108103, 0.0007692751, 0.276091516, 0.000784202, -0.1791669577, 0.1693535, -0.0637614131, -0.4431353807, 0.2583421171, 0.366419971, 0.2560351789, -0.3944435716, -0.3703474402, -0.1771429926, -0.3999646306, -0.2454400957, 0.1234321892, 0.0697476119, -0.0844348148, 0.1232957244, 0.223929584, -0.1587907225, -0.0421670936, 0.282708168, 0.2458967119, 0.1164725274, 0.6250907183, 0.1420298964, -0.2136123627, -0.2528683841, 0.0410646424, 0.2418820411, -0.4038006067, 0.2405817509, 0.0724533722, 0.0953911394, 0.0289486777, 0.0958367288, 0.2089329511, 0.4507567585, -0.1446698308, -0.5494534373, -0.5519042015, 0.3133973181, -0.3650941551, 0.1240872219, 0.0728809983, 0.0119036091, -0.0238187872, 0.0976892486, -0.28880319, -0.0474174134, -0.3507492244, 0.0590478741, -0.0160405263, -0.0977909788, -0.0120489895, -0.0036972524, 0.2137143165, 0.2369949073, -0.1554047912, -0.3096165955, 0.1651389003, 0.0450443849, 0.1219116896, -0.4085613489, -0.1422495246, -0.1819285601, -0.0714026466, -0.1304440796, -0.1986450255, 0.0088195633, -0.0786495432, -0.1377132386, 0.2962079048, -0.0935741961, -0.2675310671, 0.0401340052, -0.2507910132, 0.2575211525, 0.0955287889, 0.0755476132, 0.3524125814, 0.0259379167, -0.2118295431, 0.0399077199, -0.0894019306, -0.1462777555, 0.3332201242, -0.3912500739, -0.3031312823, 0.015577428, 0.4696730673, 0.2980314493, -0.1497735083, 0.0706829876, -0.0487040058, 0.2152475268, -0.3896290064, -0.1665168256, -0.0059126448, 0.0592270643, -0.0484119095, 0.319621563, 0.2594075799, -0.2182893753, 0.2811605632, 0.216570735, 0.2245478779, 0.014096532, -0.1251775026, 0.6010940671, -0.1161143556, -0.2117933184, 0.4168364108, 0.2926371396, 0.5112425089, 0.2606072426, -0.1071603373, 0.1381424218, 0.2688386142, 0.1799879819, -0.0583728962, -0.4001863301, -0.1858806014, 0.1077913344, 0.1066513062, -0.1382405013, 0.1256547272, -0.0280109402, 0.2579558194, 0.0361023583, 0.1478010863, 0.0859167799, -0.1818323731, 0.0219460744, 0.0008074972, 0.1250001937, 0.048473116, -0.2068498135, 0.0252286289, -0.3063668311, 0.2777521908, 0.0016674224, -0.085800454, -0.439966172, 0.1806318313, 0.5117086172, -0.1094689444, -0.1741169244, 0.3285870552, 0.4242917597, -0.02374826, -0.1503317952, 0.3860249221, 0.5804914236, 0.2409936786, -0.0238723867, 0.2077870667, -0.008149513, -0.1690757722, -0.0604740307, 0.0909240767, 0.0978052691, 0.1481953859, 0.1423253417, 0.2105999589, -0.1486495882, 0.2147821486, 0.3060649335, 0.1065621823, -0.2027073354, 0.1401877999, -0.11626672, -0.2585430145, -0.0850694254, -0.0174533557, -0.4101572335, 0.1649526805, 0.418204546, -0.1200688034, -0.0165554192, 0.1644588113, 0.0681712553, -0.3404386044, 0.4425361454, 0.2781798244, 0.2539975047, -0.1694389582, 0.0014493109, -0.4343962669, 0.2145669907, -0.3108062446, -0.1265726686, 0.1883105785, 0.3053246439, 0.2690073252, 0.3885177374, 0.1593925506, 0.1569663435, 0.0389912352, 0.1325365752, -0.3590078056, -0.1170708835, 0.1671164334, 0.1152932197, -0.1712615192, -0.1662119925, 0.311712265, 0.0199154001, 0.1010074168, -0.2547493279, -0.0726023093, -0.2228352427, 0.341465652, 0.3372592628, 0.13245745, 0.3376509845, 0.0862660855, 0.2375320196, -0.0411622152, -0.4088021815, -0.0082036303, 0.5613903403, 0.3403672874, 0.5017958879, -0.1312079579, -0.1257842481, -0.1431038231, 0.3379401267, -0.2317004502, -0.0427056104, -0.3095023036, 0.0799120888, -0.1820609123, -0.0606570877, -0.3343917429, -0.0018315569, 0.0890032724, 0.2038213462, -0.2043204308, -0.5852288604, 0.4368217587, -0.1386183053, -0.4015677869, 0.076863192, 0.0833693296, 0.0400836021, -0.0228593703, -0.2593250871, 0.1473935544, 0.2686136365, -0.0831842422, -0.3365373313, 0.0610047057, -0.0287152063, 0.2706462145, -0.1467020214, 0.3606084585, -0.1064437926, -0.0384899005, -0.1178414524, -0.1704110056 ]