espnet3.systems.esp2_lid.src.speech2language.Speech2Language
Less than 1 minute
espnet3.systems.esp2_lid.src.speech2language.Speech2Language
class espnet3.systems.esp2_lid.src.speech2language.Speech2Language(lid_train_config: str | Path, lid_model_file: str | Path, lang2utt: str | Path, device: str = 'cpu', dtype: str = 'float32', extract_embd: bool = False)
Bases: object
Predict language codes and optionally return normalized embeddings.
- Parameters:
- lid_train_config – ESPnet model configuration path.
- lid_model_file – Trained model or ESPnet3 checkpoint path.
- lang2utt – Language mapping in the model’s class order.
- device – Torch device used for inference.
- dtype – Floating-point inference dtype.
- extract_embd – Return dictionaries with
hypandembeddinginstead of language strings. Embeddings are L2-normalized, as in ESPnet2. A waveform returns one dictionary; a waveform list returns a list.
Load the trained model and its language mapping.
