Loading dataset crashes for train.bm25.tsv and train.mined.tsv configurations
#1
by
albertvillanova
HF staff
- opened
The machine crashes when loading "train.bm25.tsv" and "train.mined.tsv" configurations.
Code to reproduce the error:
from datasets import load_dataset
ds = load_dataset("THUIR/T2Ranking", "train.mined.tsv")
To load very large files, you should better iterate over their content lazily.
I would recommend you use csv.DictReader
from Python Standard Library: https://docs.python.org/3/library/csv.html#csv.DictReader
- It is a lazy iterator by default
- You really don't need any of the
pandas
features, so better avoiding the overhead of the conversion to and from Pandas DataFrame.
Alternatively, with pandas.read_csv
you can pass either iterator
or chunksize
parameters.
Hi@albertvillanova, thanks for your kindly help.
csv.DictReader
```works for our project!
qian
changed discussion status to
closed