Structure your repository
Last updated
Last updated
To host and share your dataset, create a dataset repository on the BOINC AI Hub and upload your data files.
This guide will show you how to structure your dataset repository when you upload it. A dataset with a supported structure and file format (.txt
, .csv
, .parquet
, .jsonl
, .mp3
, .jpg
, .zip
etc.) are loaded automatically with , and itβll have a dataset viewer on its dataset page on the Hub.
The simplest dataset structure has two files: train.csv
and test.csv
(this works with any supported file format).
Your repository will also contain a README.md
file, the displayed on your dataset page.
Copied
In this simple case, youβll get a dataset with two splits: train
(containing examples from train.csv
) and test
(containing examples from test.csv
).
If you have multiple files and want to define which file goes into which split, you can use the YAML configs
field at the top of your README.md.
For example, given a repository like this one:
Copied
You can define your splits by adding the configs
field in the YAML block at the top of your README.md:
Copied
You can select multiple files per split using a list of paths:
Copied
Copied
Or you can use glob patterns to automatically list all the files you need:
Copied
Note that config_name
field is required even if you have a single configuration.
Your dataset might have several subsets of data that you want to be able to load separately. In that case you can define a list of configurations inside the configs
field in YAML:
Copied
Copied
Each configuration is shown separately on the BOINC AI Hub, and can be loaded by passing its name as a second parameter:
Copied
Not only data_files
, but other builder-specific parameters can be passed via YAML, allowing for more flexibility on how to load the data while not requiring any custom code. For example, define which separator to use in which configuration to load your csv
files:
Copied
You can set a default configuration using default: true
, e.g. you can run main_data = load_dataset("my_dataset_repository")
if you set
Copied
If no YAML is provided, π Datasets searches for certain patterns in the dataset repository to automatically infer the dataset splits. There is an order to the patterns, beginning with the custom filename split format to treating all files as a single split if no pattern is found.
Your data files may also be placed into different directories named train
, test
, and validation
where each directory contains the data files for that split:
Copied
If you donβt have any non-traditional splits, then you can place the split name anywhere in the data file and it is automatically inferred. The only rule is that the split name must be delimited by non-word characters, like test-file.csv
for example instead of testfile.csv
. Supported delimiters include underscores, dashes, spaces, dots, and numbers.
For example, the following file names are all acceptable:
train split: train.csv
, my_train_file.csv
, train1.csv
validation split: validation.csv
, my_validation_file.csv
, validation1.csv
test split: test.csv
, my_test_file.csv
, test1.csv
Here is an example where all the files are placed into a directory named data
:
Copied
If your dataset splits have custom names that arenβt train
, test
, or validation
, then you can name your data files like data/<split_name>-xxxxx-of-xxxxx.csv
.
Here is an example with three splits, train
, test
, and random
:
Copied
When π Datasets canβt find any of the above patterns, then itβll treat all the files as a single train split. If your dataset splits arenβt loading as expected, it may be due to an incorrect pattern.
There are several ways to name splits. Validation splits are sometimes called βdevβ, and test splits may be referred to as βevalβ. These other split names are also supported, and the following keywords are equivalent:
train, training
validation, valid, val, dev
test, testing, eval, evaluation
The structure below is a valid repository:
Copied
If one of your splits comprises several files, π Datasets can still infer whether it is the train, validation, and test split from the file name. For example, if your train and test splits span several files:
Copied
Make sure all the files of your train
set have train in their names (same for test and validation). Even if you add a prefix or suffix to train
in the file name (like my_train_file_00001.csv
for example), π Datasets can still infer the appropriate split.
For convenience, you can also place your data files into different directories. In this case, the split name is inferred from the directory name.
Copied
Refer to to see what configuration parameters they have.
For more flexibility over how to load and generate a dataset, you can also write a .