lfeats 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lfeats-0.2.1 → lfeats-0.2.3}/PKG-INFO +37 -21
- {lfeats-0.2.1 → lfeats-0.2.3}/README.md +33 -18
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/cli.py +22 -6
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/interfaces/extractor.py +60 -10
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/interfaces/types.py +20 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/__init__.py +13 -1
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/base.py +1 -1
- lfeats-0.2.3/lfeats/models/dacvae.py +176 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/higgs_audio.py +30 -2
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/hubert.py +3 -5
- lfeats-0.2.3/lfeats/models/mimi.py +161 -0
- lfeats-0.2.3/lfeats/models/redimnet2.py +106 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/unispeech_sat.py +2 -2
- lfeats-0.2.3/lfeats/models/w2v_bert2.py +152 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/wavlm.py +2 -2
- lfeats-0.2.3/lfeats/models/wavlm_sv.py +120 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/whisper.py +2 -2
- lfeats-0.2.3/lfeats/models/x_codec.py +144 -0
- lfeats-0.2.3/lfeats/third_party/dacvae/LICENSE +202 -0
- lfeats-0.2.3/lfeats/third_party/dacvae/__init__.py +16 -0
- lfeats-0.2.3/lfeats/third_party/dacvae/model/__init__.py +5 -0
- lfeats-0.2.3/lfeats/third_party/dacvae/model/dacvae.py +727 -0
- lfeats-0.2.3/lfeats/third_party/dacvae/nn/__init__.py +6 -0
- lfeats-0.2.3/lfeats/third_party/dacvae/nn/bottleneck.py +42 -0
- lfeats-0.2.3/lfeats/third_party/dacvae/nn/layers.py +212 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/util/download.py +10 -3
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/utils/io.py +47 -31
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/utils/validation.py +17 -13
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/version.py +1 -1
- {lfeats-0.2.1 → lfeats-0.2.3}/pyproject.toml +3 -2
- {lfeats-0.2.1 → lfeats-0.2.3}/.gitignore +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/interfaces/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/interfaces/resampler.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/interfaces/utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/contentvec.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/data2vec.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/data2vec2.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/ecapa_tdnn.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/emotion2vec.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/emotion2vec_plus.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/manager.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/next_tdnn.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/r_spin.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/r_vector.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/redimnet.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/spidr.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/spin.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/sslzip.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/wav2vec2.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/models/x_vector.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/resamplers/__init__.py +1 -1
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/resamplers/base.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/resamplers/lilfilter.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/resamplers/manager.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/resamplers/scipy.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/resamplers/soxr.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/resamplers/torchaudio.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/checkpoint_utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/config/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/config/config.yaml +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/dictionary.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/modality.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/text_compressor.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/configs.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/constants.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/initialize.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/file_io.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/incremental_decoding_utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/logging/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/logging/meters.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/data2vec2.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/data2vec_audio.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/audio.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/base.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/modules.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_decoder.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_encoder.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_incremental_decoder.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_model.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/hubert/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/hubert/hubert.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/wav2vec/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/wav2vec/utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/wav2vec/wav2vec2.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/ema_module.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/fairseq_dropout.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/fp32_group_norm.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/gelu.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/gumbel_vector_quantizer.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/layer_norm.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/multihead_attention.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/quant_noise.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/same_pad.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/transpose_last.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/quantization_utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/registry.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/audio_pretraining.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/fairseq_task.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/hubert_pretraining.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/tokenizer.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/fairseq/utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/SpeakerNet.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/aggregation/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/aggregation/vap_bn_tanh_fc_bn.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/NeXt_TDNN_C256_B3_K65_7.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/NeXt_TDNN_C256_B3_K65_7_cyclical_lr_step.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/NeXt_TDNN_light_C256_B3_K65.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/main.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/NeXt_TDNN.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/TSConvNeXt.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/TSConvNeXt_light.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/preprocessing/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/preprocessing/mel_transform.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/rspin/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/rspin/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/rspin/model.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/rspin/wavlm_config.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/hubert/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/hubert/convert.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/hubert/hubert_model.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wav2vec2/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wav2vec2/wav2vec2_model.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wavlm/WavLM.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wavlm/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wavlm/modules.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/s3prl/util/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/dataio.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/encoder.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/preprocess.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/inference/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/inference/classifiers.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/inference/interfaces.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/features.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/ECAPA_TDNN.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/ResNet.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/Xvector.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/CNN.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/containers.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/linear.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/normalization.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/pooling.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/processing/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/processing/features.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/_workarounds.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/autocast.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/checkpoints.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/distributed.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/fetching.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/filter_analysis.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/logger.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/parameter_transfer.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/run_opts.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/model/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/model/base.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/model/spin.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/nn/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/nn/dnn.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/nn/hubert.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/nn/swav_vq_dis.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/nn/wavlm.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/util/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/util/model_utils.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/spin/util/padding.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/timm/LICENSE +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/timm/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/timm/layers/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/timm/layers/drop.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/timm/layers/helpers.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/third_party/timm/layers/mlp.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/utils/__init__.py +0 -0
- {lfeats-0.2.1 → lfeats-0.2.3}/lfeats/utils/paths.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: lfeats
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: A unified interface to extract hidden representations from speech foundation models
|
|
5
5
|
Project-URL: Documentation, https://takenori-y.github.io/lfeats/stable/
|
|
6
6
|
Project-URL: Source, https://github.com/takenori-y/lfeats
|
|
@@ -33,6 +33,7 @@ Requires-Dist: soundfile>=0.10.2
|
|
|
33
33
|
Requires-Dist: soxr>=0.4.0
|
|
34
34
|
Requires-Dist: torch>=2.6.0
|
|
35
35
|
Requires-Dist: torchaudio>=2.6.0
|
|
36
|
+
Requires-Dist: tqdm>=4.63.0
|
|
36
37
|
Requires-Dist: transformers>=5.3.0
|
|
37
38
|
Provides-Extra: dev
|
|
38
39
|
Requires-Dist: build; extra == 'dev'
|
|
@@ -41,7 +42,7 @@ Requires-Dist: mdformat; extra == 'dev'
|
|
|
41
42
|
Requires-Dist: numpydoc; extra == 'dev'
|
|
42
43
|
Requires-Dist: pkginfo; extra == 'dev'
|
|
43
44
|
Requires-Dist: pydata-sphinx-theme; extra == 'dev'
|
|
44
|
-
Requires-Dist: pyright
|
|
45
|
+
Requires-Dist: pyright[nodejs]; extra == 'dev'
|
|
45
46
|
Requires-Dist: pytest; extra == 'dev'
|
|
46
47
|
Requires-Dist: pytest-cov; extra == 'dev'
|
|
47
48
|
Requires-Dist: ruff; extra == 'dev'
|
|
@@ -129,6 +130,7 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
|
|
|
129
130
|
| `unispeech-sat` | `base` | 12 | 768 | [arXiv](https://arxiv.org/abs/2110.05752) | [GitHub](https://github.com/microsoft/UniSpeech) | [🤗](https://huggingface.co/microsoft/unispeech-sat-base) |
|
|
130
131
|
| | `base+` | 12 | 768 | | | [🤗](https://huggingface.co/microsoft/unispeech-sat-base-plus) |
|
|
131
132
|
| | `large` | 24 | 1024 | | | [🤗](https://huggingface.co/microsoft/unispeech-sat-large) |
|
|
133
|
+
| `w2v-bert2` | `base` | 24 | 1024 | [arXiv](https://arxiv.org/abs/2312.05187) | [GitHub](https://github.com/facebookresearch/seamless_communication) | [🤗](https://huggingface.co/facebook/w2v-bert-2.0) |
|
|
132
134
|
| `wav2vec2` | `base` | 12 | 768 | [arXiv](https://arxiv.org/abs/2006.11477) | [GitHub](https://github.com/facebookresearch/fairseq/tree/main/examples/wav2vec) | |
|
|
133
135
|
| | `large` | 24 | 1024 | | | |
|
|
134
136
|
| | `xlsr` | 24 | 1024 | [arXiv](https://arxiv.org/abs/2006.13979) | | |
|
|
@@ -148,25 +150,38 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
|
|
|
148
150
|
|
|
149
151
|
| Model Name | Model Variant | Hop Size [ms] | Dimension | Paper | Source | Model Hub |
|
|
150
152
|
| :--- | :--- | ---: | ---: | :---: | :---: | :---: |
|
|
151
|
-
| `
|
|
153
|
+
| `dacvae` | `base` | 40 | 128 | [arXiv](https://arxiv.org/abs/2410.13720) | [GitHub](https://github.com/facebookresearch/dacvae) | [🤗](https://huggingface.co/facebook/dacvae-watermarked) |
|
|
154
|
+
| `higgs-audio` | `v2` | 40 | 1024 | [Blog](https://github.com/Render-AI-Code/cog-higgs-audio/blob/main/tech_blogs/TOKENIZER_BLOG.md) | [GitHub](https://github.com/boson-ai/higgs-audio) | [🤗](https://huggingface.co/eustlb/higgs-audio-v2-tokenizer) |
|
|
155
|
+
| `mimi` | `base` | 80 | 512 | [arXiv](https://arxiv.org/abs/2410.00037) | [GitHub](https://github.com/kyutai-labs/moshi) | [🤗](https://huggingface.co/kyutai/mimi) |
|
|
156
|
+
| `x-codec` | `hubert` | 20 | 1024 | [arXiv](https://arxiv.org/abs/2408.17175) | [GitHub](https://github.com/zhenye234/xcodec) | [🤗](https://huggingface.co/hf-audio/xcodec-hubert-librispeech) |
|
|
157
|
+
| | `wavlm` | 20 | 1024 | | | [🤗](https://huggingface.co/hf-audio/xcodec-wavlm-more-data) |
|
|
152
158
|
|
|
153
159
|
### Utterance-Level Features
|
|
154
160
|
|
|
155
|
-
| Model Name | Model Variant |
|
|
156
|
-
| :--- | :--- | ---: |
|
|
157
|
-
| `ecapa-tdnn` | `base` |
|
|
158
|
-
| `next-tdnn` | `light` |
|
|
159
|
-
| | `base` |
|
|
160
|
-
| | `base-v2` |
|
|
161
|
-
| `r-vector` | `base` |
|
|
162
|
-
| `redimnet` | `b0` |
|
|
163
|
-
| | `b1` |
|
|
164
|
-
| | `b2` |
|
|
165
|
-
| | `b3` |
|
|
166
|
-
| | `b4` |
|
|
167
|
-
| | `b5` |
|
|
168
|
-
| | `b6` |
|
|
169
|
-
| `
|
|
161
|
+
| Model Name | Model Variant | Dimension | Paper | Source | Model Hub |
|
|
162
|
+
| :--- | :--- | ---: | :---: | :---: | :---: |
|
|
163
|
+
| `ecapa-tdnn` | `base` | 192 | [arXiv](https://arxiv.org/abs/2005.07143) | [GitHub](https://github.com/speechbrain/speechbrain) | [🤗](https://huggingface.co/speechbrain/spkrec-ecapa-voxceleb) |
|
|
164
|
+
| `next-tdnn` | `light` | 192 | [arXiv](https://arxiv.org/abs/2312.08603) | [GitHub](https://github.com/dmlguq456/NeXt_TDNN_ASV) | |
|
|
165
|
+
| | `base` | 192 | | | |
|
|
166
|
+
| | `base-v2` | 192 | | | |
|
|
167
|
+
| `r-vector` | `base` | 256 | [arXiv](https://arxiv.org/abs/1910.12592) | [GitHub](https://github.com/speechbrain/speechbrain) | [🤗](https://huggingface.co/speechbrain/spkrec-resnet-voxceleb) |
|
|
168
|
+
| `redimnet` | `b0` | 192 | [arXiv](https://arxiv.org/abs/2407.18223) | [GitHub](https://github.com/IDRnD/redimnet) | |
|
|
169
|
+
| | `b1` | 192 | | | |
|
|
170
|
+
| | `b2` | 192 | | | |
|
|
171
|
+
| | `b3` | 192 | | | |
|
|
172
|
+
| | `b4` | 192 | | | |
|
|
173
|
+
| | `b5` | 192 | | | |
|
|
174
|
+
| | `b6` | 192 | | | |
|
|
175
|
+
| `redimnet2` | `b0` | 192 | [arXiv](https://arxiv.org/abs/2603.11841) | [GitHub](https://github.com/PalabraAI/redimnet2) | |
|
|
176
|
+
| | `b1` | 192 | | | |
|
|
177
|
+
| | `b2` | 192 | | | |
|
|
178
|
+
| | `b3` | 192 | | | |
|
|
179
|
+
| | `b4` | 192 | | | |
|
|
180
|
+
| | `b5` | 192 | | | |
|
|
181
|
+
| | `b6` | 192 | | | |
|
|
182
|
+
| `wavlm-sv` | `base` | 512 | [arXiv](https://arxiv.org/abs/2110.13900) | [GitHub](https://github.com/microsoft/unilm/tree/master/wavlm) | [🤗](https://huggingface.co/microsoft/wavlm-base-sv) |
|
|
183
|
+
| | `base+` | 512 | | | [🤗](https://huggingface.co/microsoft/wavlm-base-plus-sv) |
|
|
184
|
+
| `x-vector` | `base` | 512 | [IEEE](https://ieeexplore.ieee.org/document/8461375) | [GitHub](https://github.com/speechbrain/speechbrain) | [🤗](https://huggingface.co/speechbrain/spkrec-xvect-voxceleb) |
|
|
170
185
|
|
|
171
186
|
> [!IMPORTANT]
|
|
172
187
|
> Users must comply with the respective licenses of the models.
|
|
@@ -347,10 +362,11 @@ This project is released under the MIT License.
|
|
|
347
362
|
|
|
348
363
|
| Repository | License |
|
|
349
364
|
| :--- | :--- |
|
|
365
|
+
| [DAC-VAE](https://github.com/facebookresearch/dacvae) | Apache-2.0 |
|
|
350
366
|
| [fairseq](https://github.com/facebookresearch/fairseq) | MIT |
|
|
351
|
-
| [
|
|
367
|
+
| [NeXt-TDNN](https://github.com/dmlguq456/NeXt_TDNN_ASV) | Apache-2.0 |
|
|
352
368
|
| [R-Spin](https://github.com/vectominist/rspin) | MIT |
|
|
353
369
|
| [S3PRL](https://github.com/s3prl/s3prl) | Apache-2.0 |
|
|
354
370
|
| [SpeechBrain](https://github.com/speechbrain/speechbrain) | Apache-2.0 |
|
|
355
371
|
| [Spin](https://github.com/vectominist/spin) | MIT |
|
|
356
|
-
| [
|
|
372
|
+
| [TIMM](https://github.com/huggingface/pytorch-image-models) | Apache-2.0 |
|
|
@@ -78,6 +78,7 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
|
|
|
78
78
|
| `unispeech-sat` | `base` | 12 | 768 | [arXiv](https://arxiv.org/abs/2110.05752) | [GitHub](https://github.com/microsoft/UniSpeech) | [🤗](https://huggingface.co/microsoft/unispeech-sat-base) |
|
|
79
79
|
| | `base+` | 12 | 768 | | | [🤗](https://huggingface.co/microsoft/unispeech-sat-base-plus) |
|
|
80
80
|
| | `large` | 24 | 1024 | | | [🤗](https://huggingface.co/microsoft/unispeech-sat-large) |
|
|
81
|
+
| `w2v-bert2` | `base` | 24 | 1024 | [arXiv](https://arxiv.org/abs/2312.05187) | [GitHub](https://github.com/facebookresearch/seamless_communication) | [🤗](https://huggingface.co/facebook/w2v-bert-2.0) |
|
|
81
82
|
| `wav2vec2` | `base` | 12 | 768 | [arXiv](https://arxiv.org/abs/2006.11477) | [GitHub](https://github.com/facebookresearch/fairseq/tree/main/examples/wav2vec) | |
|
|
82
83
|
| | `large` | 24 | 1024 | | | |
|
|
83
84
|
| | `xlsr` | 24 | 1024 | [arXiv](https://arxiv.org/abs/2006.13979) | | |
|
|
@@ -97,25 +98,38 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
|
|
|
97
98
|
|
|
98
99
|
| Model Name | Model Variant | Hop Size [ms] | Dimension | Paper | Source | Model Hub |
|
|
99
100
|
| :--- | :--- | ---: | ---: | :---: | :---: | :---: |
|
|
100
|
-
| `
|
|
101
|
+
| `dacvae` | `base` | 40 | 128 | [arXiv](https://arxiv.org/abs/2410.13720) | [GitHub](https://github.com/facebookresearch/dacvae) | [🤗](https://huggingface.co/facebook/dacvae-watermarked) |
|
|
102
|
+
| `higgs-audio` | `v2` | 40 | 1024 | [Blog](https://github.com/Render-AI-Code/cog-higgs-audio/blob/main/tech_blogs/TOKENIZER_BLOG.md) | [GitHub](https://github.com/boson-ai/higgs-audio) | [🤗](https://huggingface.co/eustlb/higgs-audio-v2-tokenizer) |
|
|
103
|
+
| `mimi` | `base` | 80 | 512 | [arXiv](https://arxiv.org/abs/2410.00037) | [GitHub](https://github.com/kyutai-labs/moshi) | [🤗](https://huggingface.co/kyutai/mimi) |
|
|
104
|
+
| `x-codec` | `hubert` | 20 | 1024 | [arXiv](https://arxiv.org/abs/2408.17175) | [GitHub](https://github.com/zhenye234/xcodec) | [🤗](https://huggingface.co/hf-audio/xcodec-hubert-librispeech) |
|
|
105
|
+
| | `wavlm` | 20 | 1024 | | | [🤗](https://huggingface.co/hf-audio/xcodec-wavlm-more-data) |
|
|
101
106
|
|
|
102
107
|
### Utterance-Level Features
|
|
103
108
|
|
|
104
|
-
| Model Name | Model Variant |
|
|
105
|
-
| :--- | :--- | ---: |
|
|
106
|
-
| `ecapa-tdnn` | `base` |
|
|
107
|
-
| `next-tdnn` | `light` |
|
|
108
|
-
| | `base` |
|
|
109
|
-
| | `base-v2` |
|
|
110
|
-
| `r-vector` | `base` |
|
|
111
|
-
| `redimnet` | `b0` |
|
|
112
|
-
| | `b1` |
|
|
113
|
-
| | `b2` |
|
|
114
|
-
| | `b3` |
|
|
115
|
-
| | `b4` |
|
|
116
|
-
| | `b5` |
|
|
117
|
-
| | `b6` |
|
|
118
|
-
| `
|
|
109
|
+
| Model Name | Model Variant | Dimension | Paper | Source | Model Hub |
|
|
110
|
+
| :--- | :--- | ---: | :---: | :---: | :---: |
|
|
111
|
+
| `ecapa-tdnn` | `base` | 192 | [arXiv](https://arxiv.org/abs/2005.07143) | [GitHub](https://github.com/speechbrain/speechbrain) | [🤗](https://huggingface.co/speechbrain/spkrec-ecapa-voxceleb) |
|
|
112
|
+
| `next-tdnn` | `light` | 192 | [arXiv](https://arxiv.org/abs/2312.08603) | [GitHub](https://github.com/dmlguq456/NeXt_TDNN_ASV) | |
|
|
113
|
+
| | `base` | 192 | | | |
|
|
114
|
+
| | `base-v2` | 192 | | | |
|
|
115
|
+
| `r-vector` | `base` | 256 | [arXiv](https://arxiv.org/abs/1910.12592) | [GitHub](https://github.com/speechbrain/speechbrain) | [🤗](https://huggingface.co/speechbrain/spkrec-resnet-voxceleb) |
|
|
116
|
+
| `redimnet` | `b0` | 192 | [arXiv](https://arxiv.org/abs/2407.18223) | [GitHub](https://github.com/IDRnD/redimnet) | |
|
|
117
|
+
| | `b1` | 192 | | | |
|
|
118
|
+
| | `b2` | 192 | | | |
|
|
119
|
+
| | `b3` | 192 | | | |
|
|
120
|
+
| | `b4` | 192 | | | |
|
|
121
|
+
| | `b5` | 192 | | | |
|
|
122
|
+
| | `b6` | 192 | | | |
|
|
123
|
+
| `redimnet2` | `b0` | 192 | [arXiv](https://arxiv.org/abs/2603.11841) | [GitHub](https://github.com/PalabraAI/redimnet2) | |
|
|
124
|
+
| | `b1` | 192 | | | |
|
|
125
|
+
| | `b2` | 192 | | | |
|
|
126
|
+
| | `b3` | 192 | | | |
|
|
127
|
+
| | `b4` | 192 | | | |
|
|
128
|
+
| | `b5` | 192 | | | |
|
|
129
|
+
| | `b6` | 192 | | | |
|
|
130
|
+
| `wavlm-sv` | `base` | 512 | [arXiv](https://arxiv.org/abs/2110.13900) | [GitHub](https://github.com/microsoft/unilm/tree/master/wavlm) | [🤗](https://huggingface.co/microsoft/wavlm-base-sv) |
|
|
131
|
+
| | `base+` | 512 | | | [🤗](https://huggingface.co/microsoft/wavlm-base-plus-sv) |
|
|
132
|
+
| `x-vector` | `base` | 512 | [IEEE](https://ieeexplore.ieee.org/document/8461375) | [GitHub](https://github.com/speechbrain/speechbrain) | [🤗](https://huggingface.co/speechbrain/spkrec-xvect-voxceleb) |
|
|
119
133
|
|
|
120
134
|
> [!IMPORTANT]
|
|
121
135
|
> Users must comply with the respective licenses of the models.
|
|
@@ -296,10 +310,11 @@ This project is released under the MIT License.
|
|
|
296
310
|
|
|
297
311
|
| Repository | License |
|
|
298
312
|
| :--- | :--- |
|
|
313
|
+
| [DAC-VAE](https://github.com/facebookresearch/dacvae) | Apache-2.0 |
|
|
299
314
|
| [fairseq](https://github.com/facebookresearch/fairseq) | MIT |
|
|
300
|
-
| [
|
|
315
|
+
| [NeXt-TDNN](https://github.com/dmlguq456/NeXt_TDNN_ASV) | Apache-2.0 |
|
|
301
316
|
| [R-Spin](https://github.com/vectominist/rspin) | MIT |
|
|
302
317
|
| [S3PRL](https://github.com/s3prl/s3prl) | Apache-2.0 |
|
|
303
318
|
| [SpeechBrain](https://github.com/speechbrain/speechbrain) | Apache-2.0 |
|
|
304
319
|
| [Spin](https://github.com/vectominist/spin) | MIT |
|
|
305
|
-
| [
|
|
320
|
+
| [TIMM](https://github.com/huggingface/pytorch-image-models) | Apache-2.0 |
|
|
@@ -12,6 +12,8 @@ import os
|
|
|
12
12
|
import sys
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
|
|
15
|
+
from tqdm import tqdm
|
|
16
|
+
|
|
15
17
|
logger = logging.getLogger("lfeats")
|
|
16
18
|
|
|
17
19
|
|
|
@@ -120,11 +122,18 @@ def get_arguments() -> argparse.Namespace:
|
|
|
120
122
|
"--reduction",
|
|
121
123
|
type=str,
|
|
122
124
|
default="auto",
|
|
125
|
+
choices=["none", "mean", "auto"],
|
|
123
126
|
help=(
|
|
124
127
|
"The reduction method to apply to the extracted features. Can be 'none', "
|
|
125
128
|
"'mean', or 'auto'."
|
|
126
129
|
),
|
|
127
130
|
)
|
|
131
|
+
parser.add_argument(
|
|
132
|
+
"--normalize",
|
|
133
|
+
action=argparse.BooleanOptionalAction,
|
|
134
|
+
default=False,
|
|
135
|
+
help="Enable or disable L2 normalization of the extracted features.",
|
|
136
|
+
)
|
|
128
137
|
parser.add_argument(
|
|
129
138
|
"-q",
|
|
130
139
|
"--quiet",
|
|
@@ -163,6 +172,7 @@ def main() -> None:
|
|
|
163
172
|
for root, _, files in os.walk(args.source):
|
|
164
173
|
for file in files:
|
|
165
174
|
input_files.append(os.path.join(root, file))
|
|
175
|
+
input_files = sorted(input_files)
|
|
166
176
|
else:
|
|
167
177
|
raise ValueError(f"Invalid source: {args.source}")
|
|
168
178
|
|
|
@@ -174,12 +184,14 @@ def main() -> None:
|
|
|
174
184
|
# Parse the layers argument.
|
|
175
185
|
if args.layers in ("all", "last"):
|
|
176
186
|
layers = args.layers
|
|
177
|
-
elif "," in args.layers:
|
|
178
|
-
layers = [int(layer.strip()) for layer in args.layers.split(",")]
|
|
179
|
-
elif args.layers.isdigit():
|
|
180
|
-
layers = int(args.layers)
|
|
181
187
|
else:
|
|
182
|
-
|
|
188
|
+
try:
|
|
189
|
+
if "," in args.layers:
|
|
190
|
+
layers = [int(layer.strip()) for layer in args.layers.split(",")]
|
|
191
|
+
else:
|
|
192
|
+
layers = int(args.layers)
|
|
193
|
+
except ValueError as e:
|
|
194
|
+
raise ValueError(f"Invalid layers argument: {args.layers}") from e
|
|
183
195
|
|
|
184
196
|
output_ext = {
|
|
185
197
|
"npz": "npz",
|
|
@@ -197,12 +209,15 @@ def main() -> None:
|
|
|
197
209
|
device=args.device,
|
|
198
210
|
cache_dir=args.cache_dir,
|
|
199
211
|
)
|
|
212
|
+
logger.info(f"Loading {extractor.get_model_id()} model...")
|
|
200
213
|
extractor.load(quiet=args.quiet)
|
|
201
214
|
|
|
202
215
|
num_errors = 0
|
|
203
216
|
|
|
204
217
|
# Process each input file and extract features.
|
|
205
|
-
for input_file in
|
|
218
|
+
for input_file in tqdm(
|
|
219
|
+
input_files, desc="Processing files", unit="file", disable=args.quiet
|
|
220
|
+
):
|
|
206
221
|
if not os.path.isfile(input_file):
|
|
207
222
|
logger.error(f"Could not find file: {input_file}. Skipping.")
|
|
208
223
|
num_errors += 1
|
|
@@ -244,6 +259,7 @@ def main() -> None:
|
|
|
244
259
|
overlap_length_sec=args.overlap_length_sec,
|
|
245
260
|
upsample_factor=args.upsample_factor,
|
|
246
261
|
reduction=args.reduction,
|
|
262
|
+
normalize=args.normalize,
|
|
247
263
|
)
|
|
248
264
|
except Exception as e:
|
|
249
265
|
logger.error(f"Error processing file {input_file}: {e}. Skipping.")
|
|
@@ -102,6 +102,17 @@ class Extractor:
|
|
|
102
102
|
self.model_manager.to(device)
|
|
103
103
|
self.resampler_manager.to(device)
|
|
104
104
|
|
|
105
|
+
def get_model_id(self) -> str:
|
|
106
|
+
"""Return the identifier of the model being used.
|
|
107
|
+
|
|
108
|
+
Returns
|
|
109
|
+
-------
|
|
110
|
+
out : str
|
|
111
|
+
The identifier of the model being used.
|
|
112
|
+
|
|
113
|
+
"""
|
|
114
|
+
return self.model_manager.get_model().model_id
|
|
115
|
+
|
|
105
116
|
def __call__(
|
|
106
117
|
self,
|
|
107
118
|
source: np.ndarray | torch.Tensor | Audio,
|
|
@@ -113,6 +124,7 @@ class Extractor:
|
|
|
113
124
|
overlap_length_sec: int = 5,
|
|
114
125
|
upsample_factor: int = 1,
|
|
115
126
|
reduction: Literal["none", "mean", "auto"] = "auto",
|
|
127
|
+
normalize: bool = False,
|
|
116
128
|
) -> Features:
|
|
117
129
|
"""Extract features from the input waveform.
|
|
118
130
|
|
|
@@ -148,6 +160,9 @@ class Extractor:
|
|
|
148
160
|
determined based on the feature granularity ('none' for frame-level features
|
|
149
161
|
and 'mean' for utterance-level features).
|
|
150
162
|
|
|
163
|
+
normalize : bool, optional
|
|
164
|
+
If True, the extracted features will be L2-normalized.
|
|
165
|
+
|
|
151
166
|
Returns
|
|
152
167
|
-------
|
|
153
168
|
out : Features
|
|
@@ -188,14 +203,17 @@ class Extractor:
|
|
|
188
203
|
chunk_length_sec=chunk_length_sec,
|
|
189
204
|
overlap_length_sec=overlap_length_sec,
|
|
190
205
|
reduction=reduction,
|
|
206
|
+
normalize=normalize,
|
|
191
207
|
)
|
|
192
208
|
|
|
193
209
|
model = self.model_manager.get_model()
|
|
194
210
|
if model.granularity != Granularity.FRAME or reduction == "mean":
|
|
195
211
|
raise ValueError("Upsampling is only supported for frame-level features.")
|
|
196
212
|
|
|
197
|
-
# Prepare the audio data
|
|
213
|
+
# Prepare the audio data at the model's sample rate so that the shifts below
|
|
214
|
+
# are measured in the same unit as the frame shift.
|
|
198
215
|
audio = create_audio_object(source, sample_rate)
|
|
216
|
+
audio = self._resample(audio, model.sample_rate)
|
|
199
217
|
B, T = audio.data.shape
|
|
200
218
|
frame_shift = model.frame_shift
|
|
201
219
|
if frame_shift % upsample_factor != 0:
|
|
@@ -209,8 +227,10 @@ class Extractor:
|
|
|
209
227
|
shifted_waveforms = audio.zeros((B * upsample_factor, T))
|
|
210
228
|
for i in range(upsample_factor):
|
|
211
229
|
offset = i * step
|
|
212
|
-
|
|
213
|
-
|
|
230
|
+
if offset < T:
|
|
231
|
+
shifted_waveforms[i::upsample_factor, : T - offset] = audio.data[ # type: ignore
|
|
232
|
+
:, offset:
|
|
233
|
+
]
|
|
214
234
|
|
|
215
235
|
# Extract features from the shifted waveforms.
|
|
216
236
|
features = self._extract(
|
|
@@ -220,6 +240,7 @@ class Extractor:
|
|
|
220
240
|
center=center,
|
|
221
241
|
chunk_length_sec=chunk_length_sec,
|
|
222
242
|
overlap_length_sec=overlap_length_sec,
|
|
243
|
+
normalize=normalize,
|
|
223
244
|
)
|
|
224
245
|
|
|
225
246
|
# Interleave the features from the shifted waveforms.
|
|
@@ -243,6 +264,7 @@ class Extractor:
|
|
|
243
264
|
chunk_length_sec: int = 30,
|
|
244
265
|
overlap_length_sec: int = 5,
|
|
245
266
|
reduction: Literal["none", "mean", "auto"] = "auto",
|
|
267
|
+
normalize: bool = False,
|
|
246
268
|
) -> Features:
|
|
247
269
|
"""Extract features from the input waveform.
|
|
248
270
|
|
|
@@ -275,6 +297,9 @@ class Extractor:
|
|
|
275
297
|
determined based on the feature granularity ('none' for frame-level features
|
|
276
298
|
and 'mean' for utterance-level features).
|
|
277
299
|
|
|
300
|
+
normalize : bool, optional
|
|
301
|
+
If True, the extracted features will be L2-normalized.
|
|
302
|
+
|
|
278
303
|
Returns
|
|
279
304
|
-------
|
|
280
305
|
out : Features
|
|
@@ -301,17 +326,16 @@ class Extractor:
|
|
|
301
326
|
model.load(self.cache_dir, quiet=False)
|
|
302
327
|
if model.chunk_length_sec is not None:
|
|
303
328
|
chunk_length_sec = model.chunk_length_sec
|
|
329
|
+
if chunk_length_sec <= overlap_length_sec:
|
|
330
|
+
raise ValueError(
|
|
331
|
+
f"overlap_length_sec ({overlap_length_sec}) must be less than the "
|
|
332
|
+
f"model's fixed chunk length ({chunk_length_sec})."
|
|
333
|
+
)
|
|
304
334
|
normalized_layers = self._normalize_layers(layers, model.num_layers + 1)
|
|
305
335
|
|
|
306
336
|
# Prepare the audio data.
|
|
307
337
|
audio = create_audio_object(source, sample_rate)
|
|
308
|
-
|
|
309
|
-
# Resample the audio if needed.
|
|
310
|
-
if audio.sample_rate != model.sample_rate:
|
|
311
|
-
resampler = self.resampler_manager.get_resampler(
|
|
312
|
-
audio.sample_rate, model.sample_rate
|
|
313
|
-
)
|
|
314
|
-
audio = resampler.resample(audio)
|
|
338
|
+
audio = self._resample(audio, model.sample_rate)
|
|
315
339
|
expected_num_frames = self._get_num_frames(audio.length, model.frame_shift)
|
|
316
340
|
|
|
317
341
|
# Pad the audio if needed.
|
|
@@ -377,8 +401,34 @@ class Extractor:
|
|
|
377
401
|
):
|
|
378
402
|
features = features.reduce("mean")
|
|
379
403
|
|
|
404
|
+
# Apply normalization if specified.
|
|
405
|
+
if normalize:
|
|
406
|
+
features = features.normalize()
|
|
407
|
+
|
|
380
408
|
return features
|
|
381
409
|
|
|
410
|
+
def _resample(self, audio: Audio, sample_rate: int) -> Audio:
|
|
411
|
+
"""Resample the audio to the specified sample rate if needed.
|
|
412
|
+
|
|
413
|
+
Parameters
|
|
414
|
+
----------
|
|
415
|
+
audio : Audio
|
|
416
|
+
The input audio data.
|
|
417
|
+
|
|
418
|
+
sample_rate : int
|
|
419
|
+
The target sample rate in Hz.
|
|
420
|
+
|
|
421
|
+
Returns
|
|
422
|
+
-------
|
|
423
|
+
out : Audio
|
|
424
|
+
The resampled audio data.
|
|
425
|
+
|
|
426
|
+
"""
|
|
427
|
+
if audio.sample_rate == sample_rate:
|
|
428
|
+
return audio
|
|
429
|
+
resampler = self.resampler_manager.get_resampler(audio.sample_rate, sample_rate)
|
|
430
|
+
return resampler.resample(audio)
|
|
431
|
+
|
|
382
432
|
@staticmethod
|
|
383
433
|
def _get_num_frames(length: int, frame_shift: int) -> int:
|
|
384
434
|
"""Calculate the number of frames for a given sample length.
|
|
@@ -356,6 +356,26 @@ class Features(Container):
|
|
|
356
356
|
|
|
357
357
|
return Features(data=reduced_data, source=self.source, layers=self.layers)
|
|
358
358
|
|
|
359
|
+
def normalize(self) -> Features:
|
|
360
|
+
"""Normalize the features in the L2 sense along the feature dimension.
|
|
361
|
+
|
|
362
|
+
Returns
|
|
363
|
+
-------
|
|
364
|
+
out : Features
|
|
365
|
+
A new Features instance with normalized data.
|
|
366
|
+
|
|
367
|
+
"""
|
|
368
|
+
eps = 1e-12
|
|
369
|
+
if isinstance(self.data, np.ndarray):
|
|
370
|
+
norm = np.linalg.norm(self.array, ord=2, axis=-1, keepdims=True)
|
|
371
|
+
normalized_data = self.array / np.maximum(norm, eps)
|
|
372
|
+
else:
|
|
373
|
+
normalized_data = torch.nn.functional.normalize(
|
|
374
|
+
self.tensor, p=2, dim=-1, eps=eps
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
return Features(data=normalized_data, source=self.source, layers=self.layers)
|
|
378
|
+
|
|
359
379
|
def concat(self, other: Features) -> Features:
|
|
360
380
|
"""Concatenate this Features instance with another one along the time dimension.
|
|
361
381
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"""The module for audio feature extraction models."""
|
|
5
5
|
|
|
6
6
|
from .contentvec import ContentVecModel
|
|
7
|
+
from .dacvae import DACVAEModel
|
|
7
8
|
from .data2vec import Data2VecModel
|
|
8
9
|
from .data2vec2 import Data2Vec2Model
|
|
9
10
|
from .ecapa_tdnn import EcapaTDNNModel
|
|
@@ -12,21 +13,27 @@ from .emotion2vec_plus import Emotion2VecPlusModel
|
|
|
12
13
|
from .higgs_audio import HiggsAudioTokenizerModel
|
|
13
14
|
from .hubert import HuBERTModel
|
|
14
15
|
from .manager import ModelManager
|
|
16
|
+
from .mimi import MimiModel
|
|
15
17
|
from .next_tdnn import NeXtTDNNModel
|
|
16
18
|
from .r_spin import RSpinModel
|
|
17
19
|
from .r_vector import RVectorModel
|
|
18
20
|
from .redimnet import ReDimNetModel
|
|
21
|
+
from .redimnet2 import ReDimNet2Model
|
|
19
22
|
from .spidr import SpidRModel
|
|
20
23
|
from .spin import SpinModel
|
|
21
24
|
from .sslzip import SSLZipModel
|
|
22
25
|
from .unispeech_sat import UniSpeechSATModel
|
|
26
|
+
from .w2v_bert2 import W2VBert2Model
|
|
23
27
|
from .wav2vec2 import Wav2Vec2Model
|
|
24
28
|
from .wavlm import WavLMModel
|
|
29
|
+
from .wavlm_sv import WavLMSVModel
|
|
25
30
|
from .whisper import WhisperModel
|
|
31
|
+
from .x_codec import XCodecModel
|
|
26
32
|
from .x_vector import XVectorModel
|
|
27
33
|
|
|
28
34
|
MODEL_MAP = {
|
|
29
35
|
"contentvec": ContentVecModel,
|
|
36
|
+
"dacvae": DACVAEModel,
|
|
30
37
|
"data2vec": Data2VecModel,
|
|
31
38
|
"data2vec2": Data2Vec2Model,
|
|
32
39
|
"ecapa-tdnn": EcapaTDNNModel,
|
|
@@ -34,21 +41,26 @@ MODEL_MAP = {
|
|
|
34
41
|
"emotion2vec+": Emotion2VecPlusModel,
|
|
35
42
|
"higgs-audio": HiggsAudioTokenizerModel,
|
|
36
43
|
"hubert": HuBERTModel,
|
|
44
|
+
"mimi": MimiModel,
|
|
37
45
|
"next-tdnn": NeXtTDNNModel,
|
|
38
46
|
"r-spin": RSpinModel,
|
|
39
47
|
"r-vector": RVectorModel,
|
|
40
48
|
"redimnet": ReDimNetModel,
|
|
49
|
+
"redimnet2": ReDimNet2Model,
|
|
41
50
|
"spidr": SpidRModel,
|
|
42
51
|
"spin": SpinModel,
|
|
43
52
|
"sslzip": SSLZipModel,
|
|
44
53
|
"unispeech-sat": UniSpeechSATModel,
|
|
54
|
+
"w2v-bert2": W2VBert2Model,
|
|
45
55
|
"wav2vec2": Wav2Vec2Model,
|
|
46
56
|
"wavlm": WavLMModel,
|
|
57
|
+
"wavlm-sv": WavLMSVModel,
|
|
47
58
|
"whisper": WhisperModel,
|
|
59
|
+
"x-codec": XCodecModel,
|
|
48
60
|
"x-vector": XVectorModel,
|
|
49
61
|
}
|
|
50
62
|
|
|
51
63
|
__all__ = [
|
|
52
|
-
"ModelManager",
|
|
53
64
|
"MODEL_MAP",
|
|
65
|
+
"ModelManager",
|
|
54
66
|
]
|