Datasets:
Data duplication issue in Parquet files
Hi @albertvillanova @lhoestq @severo @mariosasko ,
We have successfully converted the dataset to Parquet as suggested in #1 and stored this alongside the raw files. The dataset viewer now works and the dataset can be loaded without the need for trust_remote_code=True
.
However, the audio data is now duplicated: one copy as MP3 files, two copies in Parquet files (since we have one config for each language and another config for all languages combined).
Is there a way to avoid this data duplication? I know about push_to_hub(..., embed_external_files=False)
, but that breaks the dataset loading (and the dataset viewer).
One way I could imagine this working is that the main
branch would have the lightweight version of the Parquet file (referencing the audio by relative path) and then the Parquet converter would create a "complete" version with the audio embedded and put this in the refs/convert/parquet
branch. But I don't know if this is possible to achieve.
Thanks!
Hello ! Yes the Parquet converter does convert up to 5GB of data to Parquet for free.
In your case you simply need to follow the structure for audio datasets here: https://huggingface.co/docs/hub/en/datasets-audio
@lhoestq
Thanks. However, the dataset doesn't really fit within that structure, as there is also a directory with text files. So I've directly built the dataset with datasets
in Python and saved it as Parquet. My issue is that these Parquet files contain data that's duplicated elsewhere, so I would prefer not to include them in the main
branch of the repo so that anyone who clones it doesn't need to download 3 times the size of the actual data. Is there a way to do that?
The audio data take most of the storage but no need to duplicate them.
If that works for you, you can only duplicate the text and use a metadata.csv file with the lyrics. Then you can configure the Viewer to only take into account the audio files and the metadata.csv files
Yup !
@lhoestq
I tried doing it this way and cannot get it to work with multiple configs. It seems that the audiofolder
builder requires the metadata file to be called metadata.csv
or metadata.jsonl
(it's hardcoded here), meaning that there cannot be different metadata files for different configs (which in my case are en
, es
, de
, fr
, and all
, which has all languages combined).
Is there any alternative?
I plan to extend the audiofolder
to names like *_metadata.csv
, in the meantime you can have one folder per language and have one metadata.csv
in each folder with the audio files in that language.
Then the all
config can simply point to all the folders, and all the metadata.csv
files and audio files will be taken into account
Then the
all
config can simply point to all the folders, and all the metadata.csv files and audio files will be taken into account
I didn't know that was possible, how can I achieve that? With the YAML in README.md
? Would you have an example?
Yes exactly, for example
configs:
- config_name: en
data_files:
- en/audio/*.mp3
- en/metadata.csv
- config_name: all
data_files:
- */audio/*.mp3
- */metadata.csv