treble_tsdk.scene.audioloaders
Functions
|
Download a remote file to a local path, showing a progress bar. |
|
Return whether |
Classes
Load anechoic sound samples by fetching audio from a CDN URL stored in the parquet. |
|
Load audio samples from a parquet that stores file paths. |
|
Load AudioSet samples from a parquet with embedded audio bytes. |
|
Base class for audio loaders backed by a parquet of sample metadata. |
|
Load Common Voice samples from a parquet with embedded audio bytes. |
|
Load FMA samples from a parquet with embedded audio bytes. |
|
Load GigaSpeech samples from a parquet with embedded audio bytes. |
|
Load LibriSpeech samples from a parquet with embedded audio bytes. |
|
Load Multilingual LibriSpeech samples from a parquet with embedded audio bytes. |
|
Load samples from a parquet with embedded audio bytes and no natural id column. |
|
Load TED-LIUM samples from a parquet with embedded audio bytes. |
|
Load VoxPopuli samples from a parquet with embedded audio bytes. |
- class treble_tsdk.scene.audioloaders.AnechoicSoundsAudioLoader
Load anechoic sound samples by fetching audio from a CDN URL stored in the parquet.
The parquet does not embed audio bytes; instead each row carries a
urlcolumn pointing to a WAV file on the Treble CDN. Audio files are downloaded on first access and cached locally.Required columns for a compatible parquet: -
id(used to select a row). -url, the full CDN URL to the WAV file.- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.AudioPathAudioLoader
Load audio samples from a parquet that stores file paths.
Intended for datasets like https://huggingface.co/datasets/MahiA/GT-Music-Genre, where the parquet contains a path to a local folder of WAV files.
Requirements for a compatible parquet:
Must include an id column used to select a row.
Must include a path column (default: path) that points to a WAV file.
Path may be absolute or relative; relative paths are resolved against the parquet file’s parent directory.
To use your own dataset, create a parquet with the same structure (e.g. columns id, path, and optionally labels like classname) and ensure the referenced WAV files exist locally.
- __init__(parquet_url: str, cache_directory: Path | None = None, path_column: str = 'path')
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.AudioSetAudioLoader
Load AudioSet samples from a parquet with embedded audio bytes.
Requirements for a compatible parquet:
Must include an identifier column (default: video_id) used to select a row.
Must include an audio column with either a bytes field containing audio data, or a path field with a URL to the audio file (e.g.
hf://...). Stereo files are downmixed by taking the first channel.
Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="agkphysics/AudioSet", config="full", split="bal_train", audio_loader_class=treble.scene.AudioSetAudioLoader, schema_mapping={"id": "video_id"}, drop_columns=["audio"] )
- __init__(parquet_url: str, cache_directory: Path | None = None, id_column: str = 'video_id')
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.BaseAudioLoader
Base class for audio loaders backed by a parquet of sample metadata.
- __init__(loader_key: str, parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.CommonVoiceAudioLoader
Load Common Voice samples from a parquet with embedded audio bytes.
Based on https://huggingface.co/datasets/fixie-ai/common_voice_17_0
Required columns for a compatible parquet: -
path(used to select a row, serves as the unique clip identifier). -client_id, identifies the speaker. -audiowith abytesfield containing audio data. -sentence, the transcribed text.Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="fixie-ai/common_voice_17_0", audio_loader_class=CommonVoiceAudioLoader, config="en", split="train", schema_mapping={"id": "path", "transcript": "sentence"}, drop_columns=["audio"], )
- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.FMAAudioLoader
Load FMA samples from a parquet with embedded audio bytes.
Based on https://huggingface.co/datasets/benjamin-paine/free-music-archive-full
Requirements for a compatible parquet:
Must include a url column used to select a row.
Must include an audio column with a bytes field containing audio data. Stereo files are downmixed by taking the first channel.
Usage with
AudioDataset:dataset = treble.scene.AudioDataset.from_huggingface( repo_id="benjamin-paine/free-music-archive-full", audio_loader_class=FMAAudioLoader, split="train", schema_mapping={"id": "url"}, drop_columns=["audio"] )
- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.GigaSpeechAudioLoader
Load GigaSpeech samples from a parquet with embedded audio bytes.
Based on https://huggingface.co/datasets/fixie-ai/gigaspeech
Required columns for a compatible parquet: -
segment_id(used to select a row). -audiowith abytesfield containing audio data. -text, the transcribed text.The parquet also contains
begin_timeandend_timecolumns; when both are mapped viaschema_mapping,AudioDatasetautomatically computeslength_s = end_time - begin_time.Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="fixie-ai/gigaspeech", audio_loader_class=GigaSpeechAudioLoader, config="xl", split="train", schema_mapping={ "id": "segment_id", "transcript": "text", "begin_time": "begin_time", "end_time": "end_time", }, drop_columns=["audio"], )
- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.LibriSpeechAudioLoader
Load LibriSpeech samples from a parquet with embedded audio bytes.
Based on https://huggingface.co/datasets/treble-technologies/librispeech_asr_sliced and https://huggingface.co/datasets/openslr/librispeech_asr.
Required columns for a compatible parquet: - id (used to select a row). - speaker_id, must be unique. - audio with a bytes field containing audio data.
Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="treble-technologies/librispeech_asr_sliced", split="test", audio_loader_class=treble.scene.LibriSpeechAudioLoader, schema_mapping={"transcript": "text"}, drop_columns=["audio"] )
- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.MultilingualLibriSpeechAudioLoader
Load Multilingual LibriSpeech samples from a parquet with embedded audio bytes.
Based on https://huggingface.co/datasets/facebook/multilingual_librispeech
Required columns for a compatible parquet: -
id(used to select a row). -audiowith abytesfield containing audio data. -transcript, the transcribed text. -audio_duration, clip duration in seconds.Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="facebook/multilingual_librispeech", audio_loader_class=MultilingualLibriSpeechAudioLoader, config="english", split="train", schema_mapping={"length_s": "audio_duration"}, drop_columns=["audio"], )
- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.RowIndexAudioLoader
Load samples from a parquet with embedded audio bytes and no natural id column.
Intended for HF “audiofolder” datasets that only expose an
audiocolumn (plus labels), such as https://huggingface.co/datasets/437aewuh/dog-dataset. Since there is no column to key on, rows are addressed by position: pass noschema_mappingentry foridsoAudioDatasetsynthesizes one asf"{shard_hash}_{row_index}", and this loader recoversrow_indexfrom that suffix.Required columns for a compatible parquet:
audiowith a bytes field containing audio data, or a path field with a URL to the audio file (e.g.hf://...). Stereo files are downmixed by taking the first channel.
Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="437aewuh/dog-dataset", config="default", split="train", audio_loader_class=treble.scene.RowIndexAudioLoader, )
- __init__(parquet_url: str, cache_directory: Path | None = None, audio_column: str = 'audio')
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.TedliumAudioLoader
Load TED-LIUM samples from a parquet with embedded audio bytes.
Based on https://huggingface.co/datasets/sanchit-gandhi/tedlium-data (Release 3)
Required columns for a compatible parquet: -
id(used to select a row). -audiowith abytesfield containing audio data. -text, the transcribed text.Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="sanchit-gandhi/tedlium-data", audio_loader_class=TedliumAudioLoader, split="train", schema_mapping={"transcript": "text"}, drop_columns=["audio"], )
- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.
- class treble_tsdk.scene.audioloaders.VoxPopuliAudioLoader
Load VoxPopuli samples from a parquet with embedded audio bytes.
Based on https://huggingface.co/datasets/facebook/voxpopuli
Required columns for a compatible parquet: -
audio_id(used to select a row). -audiowith abytesfield containing audio data. -normalized_text, the normalized transcript.Usage with
AudioDataset:AudioDataset.from_huggingface( repo_id="facebook/voxpopuli", audio_loader_class=VoxPopuliAudioLoader, config="en", split="train", schema_mapping={"id": "audio_id", "transcript": "normalized_text"}, drop_columns=["audio"], )
- __init__(parquet_url: str, cache_directory: Path | None = None)
- Parameters:
loader_key – Unique identifier for this loader’s type, used for registry lookups.
parquet_url – Path or URL to the parquet file containing sample metadata.
cache_directory – Local directory for caching downloaded data. Defaults to an
audio_datasetssubfolder under the default TSDK cache directory.