| """Configuration, phrase banks and default catalogs for the dataset creator.""" |
|
|
| from __future__ import annotations |
|
|
| from dataclasses import dataclass, field |
| from typing import List |
|
|
|
|
| |
| |
| |
|
|
| DEFAULT_WAKE_PHRASES: List[str] = [ |
| "Hey Android", |
| "Hey, Android", |
| "Hello Android", |
| "Okay Android", |
| "OK Android", |
| "Android", |
| ] |
|
|
| DEFAULT_UNKNOWN_PHRASES: List[str] = [ |
| "Hey Andrew", |
| "Hey Adrian", |
| "Hey Andrea", |
| "Hello phone", |
| "Open settings", |
| "Start recording", |
| "Stop recording", |
| "Good morning", |
| "Where is my phone", |
| "Androids are useful", |
| "This is a test", |
| "Turn on the light", |
| "Turn off the light", |
| "Increase volume", |
| "Decrease volume", |
| "Play music", |
| "Pause music", |
| ] |
|
|
| |
| WAKE_LABEL = "hey_android" |
| UNKNOWN_LABEL = "unknown" |
| NOISE_LABEL = "background_noise" |
|
|
| NOISE_TYPES: List[str] = ["white", "pink", "brown", "hum", "fan", "cafe", "street"] |
|
|
|
|
| |
| |
| |
|
|
| @dataclass(frozen=True) |
| class PiperVoice: |
| """A downloadable Piper voice model on the Hugging Face Hub.""" |
|
|
| voice_id: str |
| repo_path: str |
| locale: str |
| description: str |
|
|
|
|
| PIPER_VOICES: List[PiperVoice] = [ |
| PiperVoice( |
| "en_US-lessac-medium", |
| "en/en_US/lessac/medium/en_US-lessac-medium", |
| "en-US", |
| "English US", |
| ), |
| PiperVoice( |
| "en_GB-alba-medium", |
| "en/en_GB/alba/medium/en_GB-alba-medium", |
| "en-GB", |
| "English GB", |
| ), |
| PiperVoice( |
| "en_GB-northern_english_male-medium", |
| "en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium", |
| "en-GB", |
| "English GB Northern male", |
| ), |
| PiperVoice( |
| "nl_NL-mls-medium", |
| "nl/nl_NL/mls/medium/nl_NL-mls-medium", |
| "nl-NL", |
| "Dutch NL", |
| ), |
| PiperVoice( |
| "de_DE-thorsten-medium", |
| "de/de_DE/thorsten/medium/de_DE-thorsten-medium", |
| "de-DE", |
| "German", |
| ), |
| PiperVoice( |
| "fr_FR-siwis-medium", |
| "fr/fr_FR/siwis/medium/fr_FR-siwis-medium", |
| "fr-FR", |
| "French", |
| ), |
| PiperVoice( |
| "es_ES-sharvard-medium", |
| "es/es_ES/sharvard/medium/es_ES-sharvard-medium", |
| "es-ES", |
| "Spanish", |
| ), |
| ] |
|
|
|
|
| |
| |
| |
|
|
| @dataclass |
| class DatasetConfig: |
| """All knobs controlling a single dataset build.""" |
|
|
| |
| out_dir: str = "output" |
| dataset_name: str = "hey_android" |
|
|
| |
| sample_rate_hz: int = 16000 |
| duration_seconds: float = 2.0 |
|
|
| |
| wake_label: str = WAKE_LABEL |
| unknown_label: str = UNKNOWN_LABEL |
| noise_label: str = NOISE_LABEL |
| wake_phrases: List[str] = field(default_factory=lambda: list(DEFAULT_WAKE_PHRASES)) |
| unknown_phrases: List[str] = field(default_factory=lambda: list(DEFAULT_UNKNOWN_PHRASES)) |
|
|
| |
| base_repeats_per_phrase_per_voice: int = 1 |
| augmentations_per_speech_clip: int = 8 |
| background_noise_samples: int = 200 |
| max_piper_voices: int = 7 |
| max_gcp_voices_per_locale: int = 3 |
|
|
| |
| gcp_language_prefixes: List[str] = field( |
| default_factory=lambda: ["en", "nl", "de", "fr", "es"] |
| ) |
|
|
| |
| test_ratio: float = 0.2 |
|
|
| |
| seed: int = 1337 |
|
|
| @property |
| def target_samples(self) -> int: |
| return int(self.sample_rate_hz * self.duration_seconds) |
|
|