Loading a single split with `streaming=False` triggers download of all files
#8
by
marcospiau
- opened
Hi,
I am trying to download a single config name and split (pt-validation
) and the amount of data is small enough to be downloaded and loaded in memory. When I use ds = datasets.load_dataset('mc4', 'pt', split='validation', streaming=True)
, the only files downloaded are the ones I am interested, but when I use stream=False
, a progress bar indicates that all the 1024 training files are being downloaded and prepared.
Below is the code excerpt responsible for this:
def _split_generators(self, dl_manager):
data_urls = {}
for split in ["train", "validation"]:
data_urls[split] = [
_DATA_URL.format(
language=lang,
split_suffix="-validation" if split == "validation" else "",
index=index,
n_shards=_N_SHARDS_PER_SPLIT[lang][split],
)
for lang in self.config.languages
for index in range(_N_SHARDS_PER_SPLIT[lang][split])
]
train_downloaded_files = dl_manager.download(data_urls["train"])
validation_downloaded_files = dl_manager.download(data_urls["validation"])
return [
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": train_downloaded_files}),
datasets.SplitGenerator(
name=datasets.Split.VALIDATION, gen_kwargs={"filepaths": validation_downloaded_files}
),
]
Is there a way to change this behavior to download only the data I am interested instead of all files?
Thanks,
Marcos