espnet3.systems.esp2_cls.src.audio_conversion_provider.AudioConversionProvider
espnet3.systems.esp2_cls.src.audio_conversion_provider.AudioConversionProvider
class espnet3.systems.esp2_cls.src.audio_conversion_provider.AudioConversionProvider(config: DictConfig, params: Dict[str, Any] | None = None)
Bases: EnvironmentProvider
Provider for converting source clips to the recipe’s audio format.
Builds the job list and the ffmpeg invocation shared by espnet3.systems.esp2_cls.src.audio_conversion_runner.AudioConversionRunner workers. Nothing expensive is loaded here: a worker only needs the path to ffmpeg and the target format.
A recipe’s DatasetBuilder.build collects the conversions it needs and hands them over as jobs:
provider = AudioConversionProvider(
config=training_config,
params={
"jobs": [(clip, wav) for clip, wav in pending],
"sampling_rate": 16000,
},
)
runner = AudioConversionRunner(provider=provider, output_dir=shards)
results = runner(range(len(pending)))Initialize the provider.
- Parameters:
- config – Configuration of the stage that owns the conversion.
- params – Extra parameters forwarded from the driver to workers:
jobs(required),sampling_rate(required),channels(optional, defaults to 1) andffmpeg(optional, defaults to whatever is onPATH).
build_env_local() → Dict[str, Any]
Build the environment once on the driver for local execution.
- Returns: The job list and conversion settings consumed by
AudioConversionRunner.forward. - Return type: Dict[str, Any]
- Raises:RuntimeError – If a required parameter is missing or
ffmpegis not installed.
Example
>>> provider = AudioConversionProvider(
... config=OmegaConf.create({}),
... params={"jobs": [("a.mp4", "a.wav")], "sampling_rate": 16000},
... )
>>> sorted(provider.build_env_local())
['channels', 'ffmpeg', 'jobs', 'sampling_rate']build_worker_setup_fn() → Callable[[], Dict[str, Any]]
Create a worker setup function for distributed execution.
- Returns: A zero-arg callable executed once per worker that returns the environment dictionary consumed by
AudioConversionRunner.forward. - Return type: Callable[[], Dict[str, Any]]
