ESPnet
multilingual
audio
language-identification

ESPnet2 LID model

espnet/mms1b-lid-softmax-hard-fleurs

This model was trained by Shunsuke Mitsumori using fleurs_cs_lid recipe in espnet.

Demo: How to use in ESPnet2

Follow the ESPnet installation instructions if you haven't done that already. Until espnet/espnet#6977 is merged, install ESPnet from its branch:

git clone https://github.com/Shunsuke32/espnet.git; cd espnet; git checkout ce87fcebe451a5fd717ab254153679cc263ec535
pip install -e .

The top-1 class is the prediction.

import soundfile as sf
import torch
import torch.nn.functional as F
from espnet_model_zoo.downloader import ModelDownloader
from espnet2.tasks.lid import LIDTask

files = ModelDownloader().download_and_unpack("espnet/mms1b-lid-softmax-hard-fleurs")
model, args = LIDTask.build_model_from_file(files["train_config"], files["model_file"])
languages = [line.split()[0] for line in open(args.lang2utt)]

speech, _ = sf.read("speech.wav", dtype="float32")  # 16 kHz mono
with torch.inference_mode():
    embd, _ = model.eval()(torch.tensor(speech)[None], torch.tensor([len(speech)]), extract_embd=True)
    scores = (F.normalize(embd) @ F.normalize(model.loss.weight).T).view(len(languages), -1).amax(1)
print(languages[scores.argmax()])  # e.g. 'spa'

Results

Exact language-set accuracy (%). "seen" / "unseen": the two-language set does / does not occur in the CS-FLEURS training data (the same split for every model). CS-FLEURS all is the union of the four CS-FLEURS test sets.

Test set Split n FLEURS
FLEURS all 77,808 96.71
CS-FLEURS all all 49,297 8.33
CS-FLEURS all seen 20,154 10.70
CS-FLEURS all unseen 29,143 6.69
CS read all 5,818 13.42
CS read seen 5,307 14.60
CS read unseen 511 1.17
CS XTTS1 seen 11,321 1.71
CS XTTS2 unseen 17,226 0.51
CS MMS all 14,932 20.37
CS MMS seen 3,526 33.66
CS MMS unseen 11,406 16.26

LID config

expand
config: conf/tuning/train_mms_ecapa_softmax_hard_fleurs.yaml
print_config: false
log_level: INFO
drop_last_iter: true
dry_run: false
iterator_type: category
valid_iterator_type: category
output_dir: exp/lid_train_mms_ecapa_softmax_hard_fleurs_raw
ngpu: 1
seed: 3702
num_workers: 8
num_att_plot: 0
dist_backend: nccl
dist_init_method: env://
dist_world_size: 2
dist_rank: 0
local_rank: 0
dist_master_addr: localhost
dist_master_port: 37067
dist_launcher: null
multiprocessing_distributed: true
unused_parameters: true
sharded_ddp: false
use_deepspeed: false
deepspeed_config: null
gradient_as_bucket_view: true
ddp_comm_hook: null
cudnn_enabled: true
cudnn_benchmark: true
cudnn_deterministic: false
use_tf32: false
collect_stats: false
write_collected_feats: false
max_epoch: 30
patience: null
val_scheduler_criterion:
- valid
- loss
early_stopping_criterion:
- valid
- loss
- min
best_model_criterion:
-   - valid
    - accuracy
    - max
keep_nbest_models: 2
nbest_averaging_interval: 0
grad_clip: 9999
grad_clip_type: 2.0
grad_noise: false
accum_grad: 4
no_forward_run: false
resume: true
train_dtype: float32
use_amp: true
log_interval: 100
use_matplotlib: true
use_tensorboard: true
create_graph_in_tensorboard: false
use_wandb: false
wandb_project: null
wandb_id: null
wandb_entity: null
wandb_name: null
wandb_model_log_interval: -1
wandb_allow_val_change: true
detect_anomaly: false
use_adapter: false
adapter: lora
save_strategy: all
adapter_conf: {}
pretrain_path: null
init_param: []
ignore_init_mismatch: false
freeze_param: []
num_iters_per_epoch: 3360
batch_size: 8
valid_batch_size: 8
batch_bins: 1000000
valid_batch_bins: null
category_sample_size: 10
upsampling_factor: 0.5
category_upsampling_factor: 0.5
dataset_upsampling_factor: 0.5
dataset_scaling_factor: 1.2
max_batch_size: null
min_batch_size: 1
train_shape_file:
- exp/lid_stats_raw_fleurs/train/speech_shape
valid_shape_file:
- exp/lid_stats_raw_fleurs/valid/speech_shape
batch_type: catbel
valid_batch_type: null
fold_length:
- 120000
sort_in_batch: descending
shuffle_within_batch: false
sort_batch: descending
multiple_iterator: false
chunk_length: 500
chunk_shift_ratio: 0.5
num_cache_chunks: 1024
chunk_excluded_key_prefixes: []
chunk_default_fs: null
chunk_max_abs_length: null
chunk_discard_short_samples: true
train_data_path_and_name_and_type:
-   - dump/raw/train_fleurscs_fleurs/wav.scp
    - speech
    - sound
-   - dump/raw/train_fleurscs_fleurs/utt2lang
    - lid_labels
    - text
valid_data_path_and_name_and_type:
-   - dump/raw/valid_fleurscs_fleurs/wav.scp
    - speech
    - sound
-   - dump/raw/valid_fleurscs_fleurs/utt2lang
    - lid_labels
    - text
multi_task_dataset: false
allow_variable_data_keys: false
max_cache_size: 0.0
max_cache_fd: 32
allow_multi_rates: false
valid_max_cache_size: null
exclude_weight_decay: false
exclude_weight_decay_conf: {}
optim: adam
optim_conf:
    lr: 5.0e-06
    betas:
    - 0.9
    - 0.98
scheduler: tristagelr
scheduler_conf:
    max_steps: 25200
    warmup_ratio: 0.1
    hold_ratio: 0.2
    decay_ratio: 0.7
    init_lr_scale: 0.6
    final_lr_scale: 0.1
init: null
use_preprocessor: true
input_size: null
target_duration: 3.0
lang2utt: dump/raw/train_fleurscs_fleurs/lang2utt
lang_num: 102
sample_rate: 16000
num_eval: 10
rir_scp: ''
model: espnet
model_conf:
    extract_feats_in_collect_stats: false
frontend: s3prl
frontend_conf:
    fs: 16000
    frontend_conf:
        upstream: hf_wav2vec2_custom
        path_or_url: facebook/mms-1b
    download_dir: ./hub
    multilayer_feature: true
specaug: null
specaug_conf: {}
normalize: utterance_mvn
normalize_conf:
    norm_vars: false
encoder: ecapa_tdnn
encoder_conf:
    model_scale: 8
    ndim: 512
    output_size: 1536
pooling: chn_attn_stat
pooling_conf: {}
projector: rawnet3
projector_conf:
    output_size: 192
encoder_condition: rawnet3
encoder_condition_conf: {}
pooling_condition: chn_attn_stat
pooling_condition_conf: {}
projector_condition: rawnet3
projector_condition_conf: {}
preprocessor: lid
preprocessor_conf:
    fix_duration: false
    sample_rate: 16000
    noise_apply_prob: 0.0
    rir_apply_prob: 0.0
loss: aamsoftmax_sc_topk
loss_conf:
    margin: 0.5
    scale: 30
    K: 3
    mp: 0.06
    k_top: 5
required:
- output_dir
version: '202604'
distributed: true

Citing this model

@misc{mitsumori2026cslid,
  title         = {Code-Switching Spoken Language Identification as Multi-Label Set Prediction},
  author        = {Mitsumori, Shunsuke and Wiesner, Matthew and Morishima, Shigeo and Watanabe, Shinji},
  year          = {2026},
  eprint        = {2610.01450},
  archivePrefix = {arXiv},
  primaryClass  = {eess.AS}
}

Citing ESPnet

@inproceedings{watanabe2018espnet,
  author={Shinji Watanabe and Takaaki Hori and Shigeki Karita and Tomoki Hayashi and Jiro Nishitoba and Yuya Unno and Nelson Yalta and Jahn Heymann and Matthew Wiesner and Nanxin Chen and Adithya Renduchintala and Tsubasa Ochiai},
  title={{ESPnet}: End-to-End Speech Processing Toolkit},
  year={2018},
  booktitle={Proceedings of Interspeech},
  pages={2207--2211},
  doi={10.21437/Interspeech.2018-1456},
  url={http://dx.doi.org/10.21437/Interspeech.2018-1456}
}





or arXiv:

@misc{watanabe2018espnet,
  title={ESPnet: End-to-End Speech Processing Toolkit},
  author={Shinji Watanabe and Takaaki Hori and Shigeki Karita and Tomoki Hayashi and Jiro Nishitoba and Yuya Unno and Nelson Yalta and Jahn Heymann and Matthew Wiesner and Nanxin Chen and Adithya Renduchintala and Tsubasa Ochiai},
  year={2018},
  eprint={1804.00015},
  archivePrefix={arXiv},
  primaryClass={cs.CL}
}
Downloads last month
54
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Papers for espnet/mms1b-lid-softmax-hard-fleurs