espnet3.systems.esp2_enh.src.inference.Inference
Less than 1 minute
espnet3.systems.esp2_enh.src.inference.Inference
class espnet3.systems.esp2_enh.src.inference.Inference(backend: Any = None, , sample_rate: int = 16000, **kwargs: Any)
Bases: object
Enhance speech with an ESPnet2 enhancement model.
- Parameters:
- backend – An already-built
SeparateSpeech, orNoneto build one fromkwargs. - sample_rate – The rate the model was trained at. The enhanced audio is returned at it.
- **kwargs –
SeparateSpeech’s own arguments,deviceincluded.
- backend – An already-built
Examples
>>> model = Inference(train_config="exp/config.yaml",
... model_file="exp/last.ckpt", device="cpu")
>>> model(speech_mix=[Audio(a, 16000), Audio(b, 16000)])
[{'enhanced': Audio(...)}, {'enhanced': Audio(...)}]Build or keep the backend and remember the model’s rate.
run(speech_mix: Audio) → Mapping[str, Any]
Return the enhanced version of one utterance.
run_batch(items: Sequence[Mapping[str, Any]]) → Sequence[Mapping]
Enhance a batch in one model call.
Shorter utterances are zero-padded for the call, and each output is cut back to its own input’s length.
