commavq / commavq.py
Yassine
only file paths for now?
53a7514
raw
history blame
921 Bytes
import datasets
import glob
import os
import numpy as np
SHARD_SIZE = 2500
NUM_SHARDS = 40
_URLS = [
f'https://huggingface.co/datasets/commaai/commavq/resolve/main/data_{i*SHARD_SIZE}_to_{(i+1)*SHARD_SIZE}.zip' for i in range(NUM_SHARDS)
]
_DESCRIPTION = """\
TODO
"""
class CommaVQ(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{"path": datasets.Value("string")}
)
)
def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
downloaded_files = dl_manager.download_and_extract(_URLS)
return [datasets.SplitGenerator(name=str(i), gen_kwargs={"filepaths": x}) for i, x in enumerate(downloaded_files)]
def _generate_examples(self, filepaths):
for path in glob.glob(f'{filepaths}/*.npy'):
name = os.path.basename(path)
yield name, {'path': path}