Datasets documentation
Loading methods
Loading methods
Methods for listing and loading datasets:
Datasets
datasets.load_dataset
< source >( path: strname: typing.Optional[str] = Nonedata_dir: typing.Optional[str] = Nonedata_files: typing.Union[str, collections.abc.Sequence[str], collections.abc.Mapping[str, typing.Union[str, collections.abc.Sequence[str]]], NoneType] = Nonesplit: typing.Union[str, datasets.splits.Split, list[str], list[datasets.splits.Split], NoneType] = Nonecache_dir: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonedownload_config: typing.Optional[datasets.download.download_config.DownloadConfig] = Nonedownload_mode: typing.Union[datasets.download.download_manager.DownloadMode, str, NoneType] = Noneverification_mode: typing.Union[datasets.utils.info_utils.VerificationMode, str, NoneType] = Nonekeep_in_memory: typing.Optional[bool] = Nonesave_infos: bool = Falserevision: typing.Union[datasets.utils.version.Version, str, NoneType] = Nonetoken: typing.Union[bool, str, NoneType] = Nonestreaming: bool = Falsenum_proc: typing.Optional[int] = Nonestorage_options: typing.Optional[dict] = None**config_kwargs ) β Dataset or DatasetDict
Parameters
- path (
str) — Path or name of the dataset.-
if
pathis a dataset repository on the HF hub (list all available datasets withhuggingface_hub.list_datasets) -> load the dataset from supported files in the repository (csv, json, parquet, etc.) e.g.'username/dataset_name', a dataset repository on the HF hub containing the data files. -
if
pathis a directory within a Storage Bucket on the HF Hub (list your buckets withhuggingface_hub.list_buckets) -> load the dataset from supported files in the directory (csv, json, parquet, etc.) e.g.'buckets/username/bucket_name/my_dataset'. -
if
pathis a local directory -> load the dataset from supported files in the directory (csv, json, parquet, etc.) e.g.'./path/to/directory/with/my/csv/data'. -
if
pathis the name of a dataset builder anddata_filesordata_diris specified (available builders are “json”, “csv”, “parquet”, “arrow”, “text”, “xml”, “webdataset”, “imagefolder”, “audiofolder”, “videofolder”, “meshfolder”) -> load the dataset from the files indata_filesordata_dire.g.'parquet'.
Use a
hf://path like'hf://datasets/username/dataset_name'to allow remote only. Use an absolute path to allow local only. -
- name (
str, optional) — Defining the name of the dataset configuration. - data_dir (
str, optional) — Defining thedata_dirof the dataset configuration. If specified for the generic builders (csv, text etc.) or the Hub datasets anddata_filesisNone, the behavior is equal to passingos.path.join(data_dir, **)asdata_filesto reference all the files in a directory. - data_files (
strorSequenceorMapping, optional) — Path(s) to source data file(s). - split (
Splitorstr) — Which split of the data to load. IfNone, will return adictwith all splits (typicallydatasets.Split.TRAINanddatasets.Split.TEST). If given, will return a single Dataset. Splits can be combined and specified like in tensorflow-datasets. - cache_dir (
str, optional) — Directory to read/write data. Defaults to"~/.cache/huggingface/datasets". - features (
Features, optional) — Set the features type to use for this dataset. - download_config (DownloadConfig, optional) — Specific download configuration parameters.
- download_mode (DownloadMode or
str, defaults toREUSE_DATASET_IF_EXISTS) — Download/generate mode. - verification_mode (VerificationMode or
str, defaults toBASIC_CHECKS) — Verification mode determining the checks to run on the downloaded/processed dataset information (checksums/size/splits/…).Added in 2.9.1
- keep_in_memory (
bool, defaults toNone) — Whether to copy the dataset in-memory. IfNone, the dataset will not be copied in-memory unless explicitly enabled by settingdatasets.config.IN_MEMORY_MAX_SIZEto nonzero. See more details in the improve performance section. - revision (Version or
str, optional) — Version of the dataset to load. As datasets have their own git repository on the Datasets Hub, the default version “main” corresponds to their “main” branch. You can specify a different version than the default “main” by using a commit SHA or a git tag of the dataset repository. - token (
strorbool, optional) — Optional string or boolean to use as Bearer token for remote files on the Datasets Hub. IfTrue, or not specified, will get token from"~/.huggingface". - streaming (
bool, defaults toFalse) — If set toTrue, don’t download the data files. Instead, it streams the data progressively while iterating on the dataset. An IterableDataset or IterableDatasetDict is returned instead in this case.Note that streaming works for datasets that use data formats that support being iterated over like txt, csv, jsonl for example. Json files may be downloaded completely. Also streaming from remote zip or gzip files is supported but other compressed formats like rar and xz are not yet supported. The tgz format doesn’t allow streaming.
- num_proc (
int, optional, defaults toNone) — Number of processes when downloading and generating the dataset locally. Multiprocessing is disabled by default.Added in 2.7.0
- storage_options (
dict, optional, defaults toNone) — Experimental. Key/value pairs to be passed on to the dataset file-system backend, if any.Added in 2.11.0
- **config_kwargs (additional keyword arguments) —
Keyword arguments to be passed to the
BuilderConfigand used in the DatasetBuilder.
Returns
- if
splitis notNone: the dataset requested, - if
splitisNone, a DatasetDict with each split.
or IterableDataset or IterableDatasetDict: if streaming=True
- if
splitis notNone, the dataset is requested - if
splitisNone, a~datasets.streaming.IterableDatasetDictwith each split.
Load a dataset from the Hugging Face Hub, or a local dataset.
You can find the list of datasets on the Hub or with huggingface_hub.list_datasets.
A dataset is a directory that contains some data files in generic formats (JSON, CSV, Parquet, etc.) and possibly in a generic structure (Webdataset, ImageFolder, AudioFolder, VideoFolder, MeshFolder, etc.)
This function does the following under the hood:
Load a dataset builder:
- Find the most common data format in the dataset and pick its associated builder (JSON, CSV, Parquet, Webdataset, ImageFolder, AudioFolder, MeshFolder, etc.)
- Find which file goes into which split (e.g. train/test) based on file and directory names or on the YAML configuration
- It is also possible to specify
data_filesmanually, and which dataset builder to use (e.g. βparquetβ).
Run the dataset builder:
In the general case:
Download the data files from the dataset if they are not already available locally or cached.
Process and cache the dataset in typed Arrow tables for caching.
Arrow table are arbitrarily long, typed tables which can store nested objects and be mapped to numpy/pandas/python generic types. They can be directly accessed from disk, loaded in RAM or even streamed over the web.
In the streaming case:
- Donβt download or cache anything. Instead, the dataset is lazily loaded and will be streamed on-the-fly when iterating on it.
Return a dataset built from the requested splits in
split(default: all).
Example:
Load a dataset from the Hugging Face Hub:
>>> from datasets import load_dataset
>>> ds = load_dataset('cornell-movie-review-data/rotten_tomatoes', split='train')
# Load a subset or dataset configuration (here 'sst2')
>>> from datasets import load_dataset
>>> ds = load_dataset('nyu-mll/glue', 'sst2', split='train')
# Manual mapping of data files to splits
>>> data_files = {'train': 'train.csv', 'test': 'test.csv'}
>>> ds = load_dataset('namespace/your_dataset_name', data_files=data_files)
# Manual selection of a directory to load
>>> ds = load_dataset('namespace/your_dataset_name', data_dir='folder_name')Load a dataset from a Storage Bucket on the Hugging Face Hub:
>>> from datasets import load_dataset
>>> ds = load_dataset('buckets/username/bucket_name/rotten_tomatoes', split='train')Load a local dataset:
# Load a CSV file
>>> from datasets import load_dataset
>>> ds = load_dataset('csv', data_files='path/to/local/my_dataset.csv')
# Load a JSON file
>>> from datasets import load_dataset
>>> ds = load_dataset('json', data_files='path/to/local/my_dataset.json')Load an IterableDataset:
>>> from datasets import load_dataset
>>> ds = load_dataset('cornell-movie-review-data/rotten_tomatoes', split='train', streaming=True)datasets.load_from_disk
< source >( dataset_path: typing.Union[str, bytes, os.PathLike]keep_in_memory: typing.Optional[bool] = Nonestorage_options: typing.Optional[dict] = None ) β Dataset or DatasetDict
Parameters
- dataset_path (
path-like) — Path (e.g."dataset/train") or remote URI (e.g."s3://my-bucket/dataset/train") of the Dataset or DatasetDict directory where the dataset/dataset-dict will be loaded from. - keep_in_memory (
bool, defaults toNone) — Whether to copy the dataset in-memory. IfNone, the dataset will not be copied in-memory unless explicitly enabled by settingdatasets.config.IN_MEMORY_MAX_SIZEto nonzero. See more details in the improve performance section. - storage_options (
dict, optional) — Key/value pairs to be passed on to the file-system backend, if any.Added in 2.9.0
Returns
- If
dataset_pathis a path of a dataset directory: the dataset requested. - If
dataset_pathis a path of a dataset dict directory, a DatasetDict with each split.
Loads a dataset that was previously saved using save_to_disk() from a dataset directory, or
from a filesystem using any implementation of fsspec.spec.AbstractFileSystem.
datasets.load_dataset_builder
< source >( path: strname: typing.Optional[str] = Nonedata_dir: typing.Optional[str] = Nonedata_files: typing.Union[str, collections.abc.Sequence[str], collections.abc.Mapping[str, typing.Union[str, collections.abc.Sequence[str]]], NoneType] = Nonecache_dir: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonedownload_config: typing.Optional[datasets.download.download_config.DownloadConfig] = Nonedownload_mode: typing.Union[datasets.download.download_manager.DownloadMode, str, NoneType] = Nonerevision: typing.Union[datasets.utils.version.Version, str, NoneType] = Nonetoken: typing.Union[bool, str, NoneType] = Nonestorage_options: typing.Optional[dict] = None**config_kwargs )
Parameters
- path (
str) — Path or name of the dataset.-
if
pathis a dataset repository on the HF hub (list all available datasets withhuggingface_hub.list_datasets) -> load the dataset builder from supported files in the repository (csv, json, parquet, etc.) e.g.'username/dataset_name', a dataset repository on the HF hub containing the data files. -
if
pathis a directory within a Storage Bucket on the HF Hub (list your buckets withhuggingface_hub.list_buckets) -> load the dataset from supported files in the directory (csv, json, parquet, etc.) e.g.'buckets/username/bucket_name/my_dataset'. -
if
pathis a local directory -> load the dataset builder from supported files in the directory (csv, json, parquet, etc.) e.g.'./path/to/directory/with/my/csv/data'. -
if
pathis the name of a dataset builder anddata_filesordata_diris specified (available builders are “json”, “csv”, “parquet”, “arrow”, “text”, “xml”, “webdataset”, “imagefolder”, “audiofolder”, “videofolder”, “meshfolder”) -> load the dataset builder from the files indata_filesordata_dire.g.'parquet'.
Use a
hf://path like'hf://datasets/username/dataset_name'to allow remote only. Use an absolute path to allow local only. -
- name (
str, optional) — Defining the name of the dataset configuration. - data_dir (
str, optional) — Defining thedata_dirof the dataset configuration. If specified for the generic builders (csv, text etc.) or the Hub datasets anddata_filesisNone, the behavior is equal to passingos.path.join(data_dir, **)asdata_filesto reference all the files in a directory. - data_files (
strorSequenceorMapping, optional) — Path(s) to source data file(s). - cache_dir (
str, optional) — Directory to read/write data. Defaults to"~/.cache/huggingface/datasets". - features (Features, optional) — Set the features type to use for this dataset.
- download_config (DownloadConfig, optional) — Specific download configuration parameters.
- download_mode (DownloadMode or
str, defaults toREUSE_DATASET_IF_EXISTS) — Download/generate mode. - revision (Version or
str, optional) — Version of the dataset to load. As datasets have their own git repository on the Datasets Hub, the default version “main” corresponds to their “main” branch. You can specify a different version than the default “main” by using a commit SHA or a git tag of the dataset repository. - token (
strorbool, optional) — Optional string or boolean to use as Bearer token for remote files on the Datasets Hub. IfTrue, or not specified, will get token from"~/.huggingface". - storage_options (
dict, optional, defaults toNone) — Experimental. Key/value pairs to be passed on to the dataset file-system backend, if any.Added in 2.11.0
- **config_kwargs (additional keyword arguments) — Keyword arguments to be passed to the BuilderConfig and used in the DatasetBuilder.
Load a dataset builder which can be used to:
- Inspect general information that is required to build a dataset (cache directory, config, dataset info, features, data files, etc.)
- Download and prepare the dataset as Arrow files in the cache
- Get a streaming dataset without downloading or caching anything
You can find the list of datasets on the Hub or with huggingface_hub.list_datasets.
A dataset is a directory that contains some data files in generic formats (JSON, CSV, Parquet, etc.) and possibly in a generic structure (Webdataset, ImageFolder, AudioFolder, VideoFolder, MeshFolder, etc.)
datasets.get_dataset_config_names
< source >( path: strrevision: typing.Union[datasets.utils.version.Version, str, NoneType] = Nonedownload_config: typing.Optional[datasets.download.download_config.DownloadConfig] = Nonedownload_mode: typing.Union[datasets.download.download_manager.DownloadMode, str, NoneType] = Nonedata_files: typing.Union[str, list, dict, NoneType] = None**download_kwargs )
Parameters
- path (
str) — path to the dataset repository. Can be either:- a local path to the dataset directory containing the data files,
e.g.
'./dataset/squad' - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with
huggingface_hub.list_datasets), e.g.'rajpurkar/squad','nyu-mll/glue'or`'openai/webtext'
- a local path to the dataset directory containing the data files,
e.g.
- revision (
Union[str, datasets.Version], optional) — If specified, the dataset module will be loaded from the datasets repository at this version. By default:- it is set to the local version of the lib.
- it will also try to load it from the main branch if it’s not available at the local version of the lib. Specifying a version that is different from your local version of the lib might cause compatibility issues.
- download_config (DownloadConfig, optional) — Specific download configuration parameters.
- download_mode (DownloadMode or
str, defaults toREUSE_DATASET_IF_EXISTS) — Download/generate mode. - data_files (
Union[Dict, List, str], optional) — Defining the data_files of the dataset configuration. - **download_kwargs (additional keyword arguments) —
Optional attributes for DownloadConfig which will override the attributes in
download_configif supplied, for exampletoken.
Get the list of available config names for a particular dataset.
datasets.get_dataset_infos
< source >( path: strdata_files: typing.Union[str, list, dict, NoneType] = Nonedownload_config: typing.Optional[datasets.download.download_config.DownloadConfig] = Nonedownload_mode: typing.Union[datasets.download.download_manager.DownloadMode, str, NoneType] = Nonerevision: typing.Union[datasets.utils.version.Version, str, NoneType] = Nonetoken: typing.Union[bool, str, NoneType] = None**config_kwargs )
Parameters
- path (
str) — path to the dataset repository. Can be either:- a local path to the dataset directory containing the data files,
e.g.
'./dataset/squad' - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with
huggingface_hub.list_datasets), e.g.'rajpurkar/squad','nyu-mll/glue'or`'openai/webtext'
- a local path to the dataset directory containing the data files,
e.g.
- revision (
Union[str, datasets.Version], optional) — If specified, the dataset module will be loaded from the datasets repository at this version. By default:- it is set to the local version of the lib.
- it will also try to load it from the main branch if it’s not available at the local version of the lib. Specifying a version that is different from your local version of the lib might cause compatibility issues.
- download_config (DownloadConfig, optional) — Specific download configuration parameters.
- download_mode (DownloadMode or
str, defaults toREUSE_DATASET_IF_EXISTS) — Download/generate mode. - data_files (
Union[Dict, List, str], optional) — Defining the data_files of the dataset configuration. - token (
strorbool, optional) — Optional string or boolean to use as Bearer token for remote files on the Datasets Hub. IfTrue, or not specified, will get token from"~/.huggingface". - **config_kwargs (additional keyword arguments) — Optional attributes for builder class which will override the attributes if supplied.
Get the meta information about a dataset, returned as a dict mapping config name to DatasetInfoDict.
datasets.get_dataset_split_names
< source >( path: strconfig_name: typing.Optional[str] = Nonedata_files: typing.Union[str, collections.abc.Sequence[str], collections.abc.Mapping[str, typing.Union[str, collections.abc.Sequence[str]]], NoneType] = Nonedownload_config: typing.Optional[datasets.download.download_config.DownloadConfig] = Nonedownload_mode: typing.Union[datasets.download.download_manager.DownloadMode, str, NoneType] = Nonerevision: typing.Union[datasets.utils.version.Version, str, NoneType] = Nonetoken: typing.Union[bool, str, NoneType] = None**config_kwargs )
Parameters
- path (
str) — path to the dataset repository. Can be either:- a local path to the dataset directory containing the data files,
e.g.
'./dataset/squad' - a dataset identifier on the Hugging Face Hub (list all available datasets and ids with
huggingface_hub.list_datasets), e.g.'rajpurkar/squad','nyu-mll/glue'or`'openai/webtext'
- a local path to the dataset directory containing the data files,
e.g.
- config_name (
str, optional) — Defining the name of the dataset configuration. - data_files (
strorSequenceorMapping, optional) — Path(s) to source data file(s). - download_config (DownloadConfig, optional) — Specific download configuration parameters.
- download_mode (DownloadMode or
str, defaults toREUSE_DATASET_IF_EXISTS) — Download/generate mode. - revision (Version or
str, optional) — Version of the dataset to load. As datasets have their own git repository on the Datasets Hub, the default version “main” corresponds to their “main” branch. You can specify a different version than the default “main” by using a commit SHA or a git tag of the dataset repository. - token (
strorbool, optional) — Optional string or boolean to use as Bearer token for remote files on the Datasets Hub. IfTrue, or not specified, will get token from"~/.huggingface". - **config_kwargs (additional keyword arguments) — Optional attributes for builder class which will override the attributes if supplied.
Get the list of available splits for a particular config and dataset.
From files
Configurations used to load data files. They are used when loading local files or a dataset repository:
- local files:
load_dataset("parquet", data_dir="path/to/data/dir") - dataset repository:
load_dataset("allenai/c4")
You can pass arguments to load_dataset to configure data loading.
For example you can specify the sep parameter to define the CsvConfig that is used to load the data:
load_dataset("csv", data_dir="path/to/data/dir", sep="\t")Text
class datasets.packaged_modules.text.TextConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Noneencoding: str = 'utf-8'encoding_errors: typing.Optional[str] = Nonechunksize: int = 10485760keep_linebreaks: bool = Falsesample_by: typing.Literal['line', 'paragraph', 'document'] = 'line' )
Parameters
- features — (
Features, optional): Cast the data tofeatures. - encoding — (
str, defaults to “utf-8”): Encoding to decode the file. - encoding_errors — (
str, optional): Argument to define what to do in case of encoding error. This is the same as theerrorargument inopen(). - chunksize — (
Features, optional, defaults to “10MB”): Chunk size to read the data. - keep_linebreaks — (
bool, defaults to False): Whether to keep line breaks. - sample_by (
Literal["line", "paragraph", "document"], defaults to “line”) — Whether to load data per line, praragraph or document. By default one row in the dataset = one line.
BuilderConfig for text files.
class datasets.packaged_modules.text.Text
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
CSV
class datasets.packaged_modules.csv.CsvConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonesep: str = ','delimiter: typing.Optional[str] = Noneheader: typing.Union[int, list[int], str, NoneType] = 'infer'names: typing.Optional[list[str]] = Nonecolumn_names: typing.Optional[list[str]] = Noneindex_col: typing.Union[int, str, list[int], list[str], NoneType] = Noneusecols: typing.Union[list[int], list[str], NoneType] = Noneprefix: typing.Optional[str] = Nonemangle_dupe_cols: bool = Trueengine: typing.Optional[typing.Literal['c', 'python', 'pyarrow']] = Noneconverters: dict = Nonetrue_values: typing.Optional[list] = Nonefalse_values: typing.Optional[list] = Noneskipinitialspace: bool = Falseskiprows: typing.Union[int, list[int], NoneType] = Nonenrows: typing.Optional[int] = Nonena_values: typing.Union[str, list[str], NoneType] = Nonekeep_default_na: bool = Truena_filter: bool = Trueverbose: bool = Falseskip_blank_lines: bool = Truethousands: typing.Optional[str] = Nonedecimal: str = '.'lineterminator: typing.Optional[str] = Nonequotechar: str = '"'quoting: int = 0escapechar: typing.Optional[str] = Nonecomment: typing.Optional[str] = Noneencoding: typing.Optional[str] = Nonedialect: typing.Optional[str] = Noneerror_bad_lines: bool = Truewarn_bad_lines: bool = Trueskipfooter: int = 0doublequote: bool = Truememory_map: bool = Falsefloat_precision: typing.Optional[str] = Nonechunksize: int = 10000features: typing.Optional[datasets.features.features.Features] = Noneencoding_errors: typing.Optional[str] = 'strict'on_bad_lines: typing.Literal['error', 'warn', 'skip'] = 'error'date_format: typing.Optional[str] = None )
BuilderConfig for CSV.
class datasets.packaged_modules.csv.Csv
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
JSON
class datasets.packaged_modules.json.JsonConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Noneencoding: str = 'utf-8'encoding_errors: typing.Optional[str] = Nonefield: typing.Optional[str] = Noneuse_threads: bool = Trueblock_size: typing.Optional[int] = Nonechunksize: int = 10485760newlines_in_values: typing.Optional[bool] = Noneon_mixed_types: typing.Optional[typing.Literal['use_json']] = 'use_json'parse_agent_traces: bool = True )
BuilderConfig for JSON.
class datasets.Json
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
XML
class datasets.packaged_modules.xml.XmlConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Noneencoding: str = 'utf-8'encoding_errors: typing.Optional[str] = None )
BuilderConfig for xml files.
class datasets.packaged_modules.xml.Xml
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Parquet
class datasets.packaged_modules.parquet.ParquetConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonebatch_size: typing.Optional[int] = Nonecolumns: typing.Optional[list[str]] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonefilters: typing.Union[pyarrow._compute.Expression, list[tuple], list[list[tuple]], NoneType] = Nonefragment_scan_options: typing.Optional[pyarrow._dataset_parquet.ParquetFragmentScanOptions] = Noneon_bad_files: typing.Literal['error', 'warn', 'skip'] = 'error' )
Parameters
- batch_size (
int, optional) — Size of the RecordBatches to iterate on. The default is the row group size (defined by the first row group). - columns (
list[str], optional) — List of columns to load, the other ones are ignored. All columns are loaded by default. - features — (
Features, optional): Cast the data tofeatures. - filters (
Union[pyarrow.dataset.Expression, list[tuple], list[list[tuple]]], optional) — Return only the rows matching the filter. If possible the predicate will be pushed down to exploit the partition information or internal metadata found in the data source, e.g. Parquet statistics. Otherwise filters the loaded RecordBatches before yielding them. - fragment_scan_options (
pyarrow.dataset.ParquetFragmentScanOptions, optional) — Scan-specific options for Parquet fragments. This is especially useful to configure buffering and caching.Added in 4.2.0
- on_bad_files (
Literal["error", "warn", "skip"], optional, defaults to “error”) — Specify what to do upon encountering a bad file (a file that can’t be read). Allowed values are :- ‘error’, raise an Exception when a bad file is encountered.
- ‘warn’, raise a warning when a bad file is encountered and skip that file.
- ‘skip’, skip bad files without raising or warning when they are encountered.
Added in 4.2.0
BuilderConfig for Parquet.
Example:
Stream data and efficiently filter data, possibly skipping entire files or row groups:
>>> filters = [("col_0", "==", 0)]
>>> ds = load_dataset(parquet_dataset_id, streaming=True, filters=filters)Increase the minimum request size when streaming from 32MiB (default) to 128MiB and enable prefetching:
>>> import pyarrow
>>> import pyarrow.dataset
>>> fragment_scan_options = pyarrow.dataset.ParquetFragmentScanOptions(
... cache_options=pyarrow.CacheOptions(
... prefetch_limit=1,
... range_size_limit=128 << 20
... ),
... )
>>> ds = load_dataset(parquet_dataset_id, streaming=True, fragment_scan_options=fragment_scan_options)class datasets.packaged_modules.parquet.Parquet
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Arrow
class datasets.packaged_modules.arrow.ArrowConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = None )
BuilderConfig for Arrow.
class datasets.packaged_modules.arrow.Arrow
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Vortex
class datasets.packaged_modules.vortex.VortexConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonebatch_size: typing.Optional[int] = Nonecolumns: typing.Optional[list[str]] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonefilters: typing.Union[ForwardRef('vortex.expr.Expr'), list[tuple], list[list[tuple]], NoneType] = Noneon_bad_files: typing.Literal['error', 'warn', 'skip'] = 'error' )
Parameters
- batch_size (
int, optional) — Size of the RecordBatches to iterate on. The default is defined by the Vortex scanner. - columns (
list[str], optional) — List of columns to load, the other ones are ignored. All columns are loaded by default. - features — (
Features, optional): Cast the data tofeatures. - filters (
Union[vortex.expr.Expr, list[tuple], list[list[tuple]]], optional) — Return only the rows matching the filter. The predicate is pushed down into the Vortex scan so only the matching rows are read. Filters given as a list of tuples (DNF, like the Parquet loader accepts) are converted to a Vortex expression. Nulls follow SQL semantics: a null satisfies no comparison, so a row whose filtered column is null is never returned. Note thatnot intherefore drops nulls, where the Parquet loader keeps them because it builds~field.isin(values)and a null is not in the set. - on_bad_files (
Literal["error", "warn", "skip"], optional, defaults to “error”) — Specify what to do upon encountering a bad file (a file that can’t be read). Allowed values are :- ‘error’, raise an Exception when a bad file is encountered.
- ‘warn’, raise a warning when a bad file is encountered and skip that file.
- ‘skip’, skip bad files without raising or warning when they are encountered.
BuilderConfig for Vortex.
Example:
class datasets.packaged_modules.vortex.Vortex
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
SQL
class datasets.packaged_modules.sql.SqlConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonesql: typing.Union[str, ForwardRef('sqlalchemy.sql.Selectable')] = Nonecon: typing.Union[str, ForwardRef('sqlalchemy.engine.Connection'), ForwardRef('sqlalchemy.engine.Engine'), ForwardRef('sqlite3.Connection')] = Noneindex_col: typing.Union[str, list[str], NoneType] = Nonecoerce_float: bool = Trueparams: typing.Union[list, tuple, dict, NoneType] = Noneparse_dates: typing.Union[list, dict, NoneType] = Nonecolumns: typing.Optional[list[str]] = Nonechunksize: typing.Optional[int] = 10000features: typing.Optional[datasets.features.features.Features] = None )
BuilderConfig for SQL.
class datasets.packaged_modules.sql.Sql
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Images
class datasets.packaged_modules.imagefolder.ImageFolderConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonedrop_labels: bool = Nonedrop_metadata: bool = Nonemetadata_filenames: list = Nonefilters: typing.Union[pyarrow._compute.Expression, list[tuple], list[list[tuple]], NoneType] = None )
BuilderConfig for ImageFolder.
class datasets.packaged_modules.imagefolder.ImageFolder
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Audio
class datasets.packaged_modules.audiofolder.AudioFolderConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonedrop_labels: bool = Nonedrop_metadata: bool = Nonemetadata_filenames: list = Nonefilters: typing.Union[pyarrow._compute.Expression, list[tuple], list[list[tuple]], NoneType] = None )
Builder Config for AudioFolder.
class datasets.packaged_modules.audiofolder.AudioFolder
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Videos
class datasets.packaged_modules.videofolder.VideoFolderConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonedrop_labels: bool = Nonedrop_metadata: bool = Nonemetadata_filenames: list = Nonefilters: typing.Union[pyarrow._compute.Expression, list[tuple], list[list[tuple]], NoneType] = None )
BuilderConfig for ImageFolder.
class datasets.packaged_modules.videofolder.VideoFolder
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
HDF5
class datasets.packaged_modules.hdf5.HDF5Config
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonebatch_size: typing.Optional[int] = Nonefeatures: typing.Optional[datasets.features.features.Features] = None )
BuilderConfig for HDF5.
class datasets.packaged_modules.hdf5.HDF5
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
ArrowBasedBuilder that converts HDF5 files to Arrow tables using the HF extension types.
TsFile
class datasets.packaged_modules.tsfile.TsFileConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonetable_name: Optional[str] = Nonecolumns: Optional[list[str]] = Nonestart_time: Optional[Any] = Noneend_time: Optional[Any] = Noneinput_batch_size: int = 65536output_batch_size: int = 32features: Optional[datasets.Features] = Noneon_bad_files: Literal['error', 'warn', 'skip'] = 'error'timestamp_unit: Literal['s', 'ms', 'us', 'ns'] = 'ms'timestamp_tz: Optional[str] = None )
Parameters
- table_name (str, optional) — Name of the table to read. When unset, the first table found in the first valid file is used. Lookups are case-insensitive.
- columns (list[str], optional) — Subset of FIELD columns to keep. TAG columns and the TIME column are always returned (they identify the device / its timeline and cannot be excluded). Names that refer to TAG or TIME columns, or to fields absent from every file, resolve quietly: TAGs/TIME are emitted as usual, and never-seen fields become all-null list columns. When unset, all FIELDs are returned.
- start_time, end_time (datetime, date, pa.TimestampScalar, ISO-8601 str, or int, optional) —
Inclusive timestamp range. Either bound may be omitted.
datetimevalues are taken in their own tz (UTC if naive);intis interpreted as a raw epoch intimestamp_unit. - input_batch_size (int, optional, defaults to 65_536) —
Maximum number of rows fetched per Arrow batch from
TsFileReader.query_table. Controls peak memory while streaming a single device. - output_batch_size (int, optional, defaults to 32) — Number of devices (output dataset rows) packed into each Arrow record batch yielded to the writer. Also the granularity at which the dataset progress bar advances; smaller values give more responsive feedback on slow per-device reads, larger ones reduce per-batch overhead.
- features (Features, optional) — Final Features schema. When provided, the metadata scan over input files is skipped.
- on_bad_files (Literal[“error”, “warn”, “skip”], optional, defaults to “error”) — What to do if a file cannot be opened or lacks the requested table.
- timestamp_unit (Literal[“s”, “ms”, “us”, “ns”], optional, defaults to “ms”) — Time unit for the timestamp column. IoTDB defaults to milliseconds.
- timestamp_tz (str, optional) —
Time zone for the timestamp column.
Nonemeans timezone-naive.
BuilderConfig for TsFile (table model) β per-device wide format.
Per-device wide-format builder for TsFile (table model).
class datasets.packaged_modules.pdffolder.PdfFolderConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonedrop_labels: bool = Nonedrop_metadata: bool = Nonemetadata_filenames: list = Nonefilters: typing.Union[pyarrow._compute.Expression, list[tuple], list[list[tuple]], NoneType] = None )
BuilderConfig for ImageFolder.
class datasets.packaged_modules.pdffolder.PdfFolder
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Nifti
class datasets.packaged_modules.niftifolder.NiftiFolderConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonedrop_labels: bool = Nonedrop_metadata: bool = Nonemetadata_filenames: list = Nonefilters: typing.Union[pyarrow._compute.Expression, list[tuple], list[list[tuple]], NoneType] = None )
BuilderConfig for NiftiFolder.
class datasets.packaged_modules.niftifolder.NiftiFolder
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
WebDataset
class datasets.packaged_modules.webdataset.WebDataset
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Harbor
class datasets.packaged_modules.harbor.HarborConfig
< source >( name: str = 'default'version: typing.Union[datasets.utils.version.Version, str, NoneType] = 0.0.0data_dir: typing.Optional[str] = Nonedata_files: typing.Union[datasets.data_files.DataFilesDict, datasets.data_files.DataFilesPatternsDict, NoneType] = Nonedescription: typing.Optional[str] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonestrip_canary: bool = Trueinclude_files: bool = True )
Parameters
- features (
Features, optional) — Set the features used to cast the generated rows. By default, the features of a Harbor task are used (seeHarbor). - strip_canary (
bool, optional, defaults toTrue) — Remove the leading “benchmark data canary” comment lines frominstruction.mdand from the instructions of the steps, as Harbor does when it sends them to an agent. - include_files (
bool, optional, defaults toTrue) — List all the files of every task (environment/,tests/,solution/…) in thefilescolumn. Set it toFalseto skip listing the task directories, which is faster when the dataset is on a remote filesystem.
BuilderConfig for Harbor task repositories.
class datasets.packaged_modules.harbor.Harbor
< source >( cache_dir: typing.Optional[str] = Nonedataset_name: typing.Optional[str] = Noneconfig_name: typing.Optional[str] = Nonehash: typing.Optional[str] = Nonebase_path: typing.Optional[str] = Noneinfo: typing.Optional[datasets.info.DatasetInfo] = Nonefeatures: typing.Optional[datasets.features.features.Features] = Nonetoken: typing.Union[bool, str, NoneType] = Nonerepo_id: typing.Optional[str] = Nonedata_files: typing.Union[str, list, dict, datasets.data_files.DataFilesDict, NoneType] = Nonedata_dir: typing.Optional[str] = Nonestorage_options: typing.Optional[dict] = Nonewriter_batch_size: typing.Optional[int] = Noneconfig_id: typing.Optional[str] = None**config_kwargs )
Builder for Harbor task repositories: one row per task directory.
It generates the following features:
- name (
str) β name of the task, asorg/namein[task].nameoftask.toml, or the name of the task directory whentask.tomlhas no[task]section. - description (
str) β[task].descriptionoftask.toml. - instruction (
str) β contents ofinstruction.md. - keywords (
listofstr) β[task].keywordsoftask.toml. - schema_version (
str) βschema_versiondeclared bytask.toml. - config (
dict) β the wholetask.toml, as a JSON object. - metadata (
dict) β the free-form[metadata]section oftask.toml. - files (
listofstr) β all the files of the task, relative to the task directory. - location (
str) β path of the task directory, relative to the root of the dataset.