lfeats 0.2.2__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.
Files changed (201) hide show
  1. {lfeats-0.2.2 → lfeats-0.2.3}/PKG-INFO +14 -3
  2. {lfeats-0.2.2 → lfeats-0.2.3}/README.md +13 -2
  3. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/cli.py +8 -5
  4. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/interfaces/extractor.py +36 -10
  5. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/__init__.py +8 -0
  6. lfeats-0.2.3/lfeats/models/dacvae.py +176 -0
  7. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/higgs_audio.py +16 -0
  8. lfeats-0.2.3/lfeats/models/mimi.py +161 -0
  9. lfeats-0.2.3/lfeats/models/redimnet2.py +106 -0
  10. lfeats-0.2.3/lfeats/models/w2v_bert2.py +152 -0
  11. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/wavlm_sv.py +1 -1
  12. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/x_codec.py +16 -0
  13. lfeats-0.2.3/lfeats/third_party/dacvae/LICENSE +202 -0
  14. lfeats-0.2.3/lfeats/third_party/dacvae/__init__.py +16 -0
  15. lfeats-0.2.3/lfeats/third_party/dacvae/model/__init__.py +5 -0
  16. lfeats-0.2.3/lfeats/third_party/dacvae/model/dacvae.py +727 -0
  17. lfeats-0.2.3/lfeats/third_party/dacvae/nn/__init__.py +6 -0
  18. lfeats-0.2.3/lfeats/third_party/dacvae/nn/bottleneck.py +42 -0
  19. lfeats-0.2.3/lfeats/third_party/dacvae/nn/layers.py +212 -0
  20. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/utils/validation.py +17 -13
  21. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/version.py +1 -1
  22. {lfeats-0.2.2 → lfeats-0.2.3}/.gitignore +0 -0
  23. {lfeats-0.2.2 → lfeats-0.2.3}/LICENSE +0 -0
  24. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/__init__.py +0 -0
  25. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/interfaces/__init__.py +0 -0
  26. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/interfaces/resampler.py +0 -0
  27. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/interfaces/types.py +0 -0
  28. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/interfaces/utils.py +0 -0
  29. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/base.py +0 -0
  30. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/contentvec.py +0 -0
  31. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/data2vec.py +0 -0
  32. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/data2vec2.py +0 -0
  33. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/ecapa_tdnn.py +0 -0
  34. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/emotion2vec.py +0 -0
  35. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/emotion2vec_plus.py +0 -0
  36. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/hubert.py +0 -0
  37. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/manager.py +0 -0
  38. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/next_tdnn.py +0 -0
  39. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/r_spin.py +0 -0
  40. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/r_vector.py +0 -0
  41. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/redimnet.py +0 -0
  42. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/spidr.py +0 -0
  43. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/spin.py +0 -0
  44. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/sslzip.py +0 -0
  45. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/unispeech_sat.py +0 -0
  46. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/wav2vec2.py +0 -0
  47. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/wavlm.py +0 -0
  48. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/whisper.py +0 -0
  49. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/models/x_vector.py +0 -0
  50. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/resamplers/__init__.py +0 -0
  51. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/resamplers/base.py +0 -0
  52. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/resamplers/lilfilter.py +0 -0
  53. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/resamplers/manager.py +0 -0
  54. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/resamplers/scipy.py +0 -0
  55. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/resamplers/soxr.py +0 -0
  56. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/resamplers/torchaudio.py +0 -0
  57. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/__init__.py +0 -0
  58. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/LICENSE +0 -0
  59. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/__init__.py +0 -0
  60. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/checkpoint_utils.py +0 -0
  61. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/config/__init__.py +0 -0
  62. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/config/config.yaml +0 -0
  63. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/__init__.py +0 -0
  64. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/dictionary.py +0 -0
  65. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/modality.py +0 -0
  66. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/data/text_compressor.py +0 -0
  67. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/__init__.py +0 -0
  68. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/configs.py +0 -0
  69. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/constants.py +0 -0
  70. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/initialize.py +0 -0
  71. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/dataclass/utils.py +0 -0
  72. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/file_io.py +0 -0
  73. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/incremental_decoding_utils.py +0 -0
  74. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/logging/__init__.py +0 -0
  75. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/logging/meters.py +0 -0
  76. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/__init__.py +0 -0
  77. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/__init__.py +0 -0
  78. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/data2vec2.py +0 -0
  79. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/data2vec_audio.py +0 -0
  80. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/__init__.py +0 -0
  81. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/audio.py +0 -0
  82. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/base.py +0 -0
  83. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/data2vec/modalities/modules.py +0 -0
  84. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_decoder.py +0 -0
  85. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_encoder.py +0 -0
  86. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_incremental_decoder.py +0 -0
  87. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/fairseq_model.py +0 -0
  88. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/hubert/__init__.py +0 -0
  89. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/hubert/hubert.py +0 -0
  90. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/wav2vec/__init__.py +0 -0
  91. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/wav2vec/utils.py +0 -0
  92. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/models/wav2vec/wav2vec2.py +0 -0
  93. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/__init__.py +0 -0
  94. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/ema_module.py +0 -0
  95. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/fairseq_dropout.py +0 -0
  96. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/fp32_group_norm.py +0 -0
  97. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/gelu.py +0 -0
  98. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/gumbel_vector_quantizer.py +0 -0
  99. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/layer_norm.py +0 -0
  100. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/multihead_attention.py +0 -0
  101. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/quant_noise.py +0 -0
  102. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/same_pad.py +0 -0
  103. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/modules/transpose_last.py +0 -0
  104. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/quantization_utils.py +0 -0
  105. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/registry.py +0 -0
  106. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/__init__.py +0 -0
  107. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/audio_pretraining.py +0 -0
  108. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/fairseq_task.py +0 -0
  109. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/tasks/hubert_pretraining.py +0 -0
  110. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/tokenizer.py +0 -0
  111. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/fairseq/utils.py +0 -0
  112. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/LICENSE +0 -0
  113. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/SpeakerNet.py +0 -0
  114. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/__init__.py +0 -0
  115. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/aggregation/__init__.py +0 -0
  116. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/aggregation/vap_bn_tanh_fc_bn.py +0 -0
  117. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/NeXt_TDNN_C256_B3_K65_7.py +0 -0
  118. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/NeXt_TDNN_C256_B3_K65_7_cyclical_lr_step.py +0 -0
  119. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/NeXt_TDNN_light_C256_B3_K65.py +0 -0
  120. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/configs/__init__.py +0 -0
  121. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/main.py +0 -0
  122. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/NeXt_TDNN.py +0 -0
  123. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/TSConvNeXt.py +0 -0
  124. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/TSConvNeXt_light.py +0 -0
  125. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/__init__.py +0 -0
  126. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/models/utils.py +0 -0
  127. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/preprocessing/__init__.py +0 -0
  128. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/next_tdnn_asv/preprocessing/mel_transform.py +0 -0
  129. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/rspin/LICENSE +0 -0
  130. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/rspin/__init__.py +0 -0
  131. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/rspin/model.py +0 -0
  132. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/rspin/wavlm_config.py +0 -0
  133. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/LICENSE +0 -0
  134. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/__init__.py +0 -0
  135. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/__init__.py +0 -0
  136. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/hubert/__init__.py +0 -0
  137. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/hubert/convert.py +0 -0
  138. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/hubert/hubert_model.py +0 -0
  139. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/utils.py +0 -0
  140. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wav2vec2/__init__.py +0 -0
  141. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wav2vec2/wav2vec2_model.py +0 -0
  142. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wavlm/WavLM.py +0 -0
  143. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wavlm/__init__.py +0 -0
  144. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/upstream/wavlm/modules.py +0 -0
  145. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/util/__init__.py +0 -0
  146. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/s3prl/util/download.py +0 -0
  147. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/LICENSE +0 -0
  148. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/__init__.py +0 -0
  149. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/__init__.py +0 -0
  150. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/dataio.py +0 -0
  151. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/encoder.py +0 -0
  152. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/dataio/preprocess.py +0 -0
  153. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/inference/__init__.py +0 -0
  154. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/inference/classifiers.py +0 -0
  155. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/inference/interfaces.py +0 -0
  156. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/__init__.py +0 -0
  157. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/features.py +0 -0
  158. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/ECAPA_TDNN.py +0 -0
  159. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/ResNet.py +0 -0
  160. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/Xvector.py +0 -0
  161. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/lobes/models/__init__.py +0 -0
  162. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/CNN.py +0 -0
  163. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/containers.py +0 -0
  164. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/linear.py +0 -0
  165. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/normalization.py +0 -0
  166. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/nnet/pooling.py +0 -0
  167. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/processing/__init__.py +0 -0
  168. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/processing/features.py +0 -0
  169. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/__init__.py +0 -0
  170. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/_workarounds.py +0 -0
  171. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/autocast.py +0 -0
  172. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/checkpoints.py +0 -0
  173. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/distributed.py +0 -0
  174. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/fetching.py +0 -0
  175. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/filter_analysis.py +0 -0
  176. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/logger.py +0 -0
  177. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/parameter_transfer.py +0 -0
  178. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/speechbrain/utils/run_opts.py +0 -0
  179. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/LICENSE +0 -0
  180. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/__init__.py +0 -0
  181. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/model/__init__.py +0 -0
  182. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/model/base.py +0 -0
  183. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/model/spin.py +0 -0
  184. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/nn/__init__.py +0 -0
  185. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/nn/dnn.py +0 -0
  186. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/nn/hubert.py +0 -0
  187. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/nn/swav_vq_dis.py +0 -0
  188. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/nn/wavlm.py +0 -0
  189. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/util/__init__.py +0 -0
  190. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/util/model_utils.py +0 -0
  191. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/spin/util/padding.py +0 -0
  192. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/timm/LICENSE +0 -0
  193. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/timm/__init__.py +0 -0
  194. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/timm/layers/__init__.py +0 -0
  195. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/timm/layers/drop.py +0 -0
  196. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/timm/layers/helpers.py +0 -0
  197. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/third_party/timm/layers/mlp.py +0 -0
  198. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/utils/__init__.py +0 -0
  199. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/utils/io.py +0 -0
  200. {lfeats-0.2.2 → lfeats-0.2.3}/lfeats/utils/paths.py +0 -0
  201. {lfeats-0.2.2 → lfeats-0.2.3}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lfeats
3
- Version: 0.2.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
@@ -130,6 +130,7 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
130
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) |
131
131
  | | `base+` | 12 | 768 | | | [🤗](https://huggingface.co/microsoft/unispeech-sat-base-plus) |
132
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) |
133
134
  | `wav2vec2` | `base` | 12 | 768 | [arXiv](https://arxiv.org/abs/2006.11477) | [GitHub](https://github.com/facebookresearch/fairseq/tree/main/examples/wav2vec) | |
134
135
  | | `large` | 24 | 1024 | | | |
135
136
  | | `xlsr` | 24 | 1024 | [arXiv](https://arxiv.org/abs/2006.13979) | | |
@@ -149,7 +150,9 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
149
150
 
150
151
  | Model Name | Model Variant | Hop Size [ms] | Dimension | Paper | Source | Model Hub |
151
152
  | :--- | :--- | ---: | ---: | :---: | :---: | :---: |
153
+ | `dacvae` | `base` | 40 | 128 | [arXiv](https://arxiv.org/abs/2410.13720) | [GitHub](https://github.com/facebookresearch/dacvae) | [🤗](https://huggingface.co/facebook/dacvae-watermarked) |
152
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) |
153
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) |
154
157
  | | `wavlm` | 20 | 1024 | | | [🤗](https://huggingface.co/hf-audio/xcodec-wavlm-more-data) |
155
158
 
@@ -169,6 +172,13 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
169
172
  | | `b4` | 192 | | | |
170
173
  | | `b5` | 192 | | | |
171
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 | | | |
172
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) |
173
183
  | | `base+` | 512 | | | [🤗](https://huggingface.co/microsoft/wavlm-base-plus-sv) |
174
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) |
@@ -352,10 +362,11 @@ This project is released under the MIT License.
352
362
 
353
363
  | Repository | License |
354
364
  | :--- | :--- |
365
+ | [DAC-VAE](https://github.com/facebookresearch/dacvae) | Apache-2.0 |
355
366
  | [fairseq](https://github.com/facebookresearch/fairseq) | MIT |
356
- | [NeXt_TDNN_ASV](https://github.com/dmlguq456/NeXt_TDNN_ASV) | Apache-2.0 |
367
+ | [NeXt-TDNN](https://github.com/dmlguq456/NeXt_TDNN_ASV) | Apache-2.0 |
357
368
  | [R-Spin](https://github.com/vectominist/rspin) | MIT |
358
369
  | [S3PRL](https://github.com/s3prl/s3prl) | Apache-2.0 |
359
370
  | [SpeechBrain](https://github.com/speechbrain/speechbrain) | Apache-2.0 |
360
371
  | [Spin](https://github.com/vectominist/spin) | MIT |
361
- | [timm](https://github.com/huggingface/pytorch-image-models) | Apache-2.0 |
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,7 +98,9 @@ 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
  | :--- | :--- | ---: | ---: | :---: | :---: | :---: |
101
+ | `dacvae` | `base` | 40 | 128 | [arXiv](https://arxiv.org/abs/2410.13720) | [GitHub](https://github.com/facebookresearch/dacvae) | [🤗](https://huggingface.co/facebook/dacvae-watermarked) |
100
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) |
101
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) |
102
105
  | | `wavlm` | 20 | 1024 | | | [🤗](https://huggingface.co/hf-audio/xcodec-wavlm-more-data) |
103
106
 
@@ -117,6 +120,13 @@ pip install git+https://github.com/takenori-y/lfeats.git@master
117
120
  | | `b4` | 192 | | | |
118
121
  | | `b5` | 192 | | | |
119
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 | | | |
120
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) |
121
131
  | | `base+` | 512 | | | [🤗](https://huggingface.co/microsoft/wavlm-base-plus-sv) |
122
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) |
@@ -300,10 +310,11 @@ This project is released under the MIT License.
300
310
 
301
311
  | Repository | License |
302
312
  | :--- | :--- |
313
+ | [DAC-VAE](https://github.com/facebookresearch/dacvae) | Apache-2.0 |
303
314
  | [fairseq](https://github.com/facebookresearch/fairseq) | MIT |
304
- | [NeXt_TDNN_ASV](https://github.com/dmlguq456/NeXt_TDNN_ASV) | Apache-2.0 |
315
+ | [NeXt-TDNN](https://github.com/dmlguq456/NeXt_TDNN_ASV) | Apache-2.0 |
305
316
  | [R-Spin](https://github.com/vectominist/rspin) | MIT |
306
317
  | [S3PRL](https://github.com/s3prl/s3prl) | Apache-2.0 |
307
318
  | [SpeechBrain](https://github.com/speechbrain/speechbrain) | Apache-2.0 |
308
319
  | [Spin](https://github.com/vectominist/spin) | MIT |
309
- | [timm](https://github.com/huggingface/pytorch-image-models) | Apache-2.0 |
320
+ | [TIMM](https://github.com/huggingface/pytorch-image-models) | Apache-2.0 |
@@ -122,6 +122,7 @@ def get_arguments() -> argparse.Namespace:
122
122
  "--reduction",
123
123
  type=str,
124
124
  default="auto",
125
+ choices=["none", "mean", "auto"],
125
126
  help=(
126
127
  "The reduction method to apply to the extracted features. Can be 'none', "
127
128
  "'mean', or 'auto'."
@@ -183,12 +184,14 @@ def main() -> None:
183
184
  # Parse the layers argument.
184
185
  if args.layers in ("all", "last"):
185
186
  layers = args.layers
186
- elif "," in args.layers:
187
- layers = [int(layer.strip()) for layer in args.layers.split(",")]
188
- elif args.layers.isdigit():
189
- layers = int(args.layers)
190
187
  else:
191
- raise ValueError(f"Invalid layers argument: {args.layers}")
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
192
195
 
193
196
  output_ext = {
194
197
  "npz": "npz",
@@ -210,8 +210,10 @@ class Extractor:
210
210
  if model.granularity != Granularity.FRAME or reduction == "mean":
211
211
  raise ValueError("Upsampling is only supported for frame-level features.")
212
212
 
213
- # Prepare the audio data and validate the upsample factor.
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.
214
215
  audio = create_audio_object(source, sample_rate)
216
+ audio = self._resample(audio, model.sample_rate)
215
217
  B, T = audio.data.shape
216
218
  frame_shift = model.frame_shift
217
219
  if frame_shift % upsample_factor != 0:
@@ -225,8 +227,10 @@ class Extractor:
225
227
  shifted_waveforms = audio.zeros((B * upsample_factor, T))
226
228
  for i in range(upsample_factor):
227
229
  offset = i * step
228
- end = T - offset
229
- shifted_waveforms[i::upsample_factor, :end] = audio.data[:, offset:] # type: ignore
230
+ if offset < T:
231
+ shifted_waveforms[i::upsample_factor, : T - offset] = audio.data[ # type: ignore
232
+ :, offset:
233
+ ]
230
234
 
231
235
  # Extract features from the shifted waveforms.
232
236
  features = self._extract(
@@ -236,6 +240,7 @@ class Extractor:
236
240
  center=center,
237
241
  chunk_length_sec=chunk_length_sec,
238
242
  overlap_length_sec=overlap_length_sec,
243
+ normalize=normalize,
239
244
  )
240
245
 
241
246
  # Interleave the features from the shifted waveforms.
@@ -321,17 +326,16 @@ class Extractor:
321
326
  model.load(self.cache_dir, quiet=False)
322
327
  if model.chunk_length_sec is not None:
323
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
+ )
324
334
  normalized_layers = self._normalize_layers(layers, model.num_layers + 1)
325
335
 
326
336
  # Prepare the audio data.
327
337
  audio = create_audio_object(source, sample_rate)
328
-
329
- # Resample the audio if needed.
330
- if audio.sample_rate != model.sample_rate:
331
- resampler = self.resampler_manager.get_resampler(
332
- audio.sample_rate, model.sample_rate
333
- )
334
- audio = resampler.resample(audio)
338
+ audio = self._resample(audio, model.sample_rate)
335
339
  expected_num_frames = self._get_num_frames(audio.length, model.frame_shift)
336
340
 
337
341
  # Pad the audio if needed.
@@ -403,6 +407,28 @@ class Extractor:
403
407
 
404
408
  return features
405
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
+
406
432
  @staticmethod
407
433
  def _get_num_frames(length: int, frame_shift: int) -> int:
408
434
  """Calculate the number of frames for a given sample length.
@@ -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,14 +13,17 @@ 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
25
29
  from .wavlm_sv import WavLMSVModel
@@ -29,6 +33,7 @@ from .x_vector import XVectorModel
29
33
 
30
34
  MODEL_MAP = {
31
35
  "contentvec": ContentVecModel,
36
+ "dacvae": DACVAEModel,
32
37
  "data2vec": Data2VecModel,
33
38
  "data2vec2": Data2Vec2Model,
34
39
  "ecapa-tdnn": EcapaTDNNModel,
@@ -36,14 +41,17 @@ MODEL_MAP = {
36
41
  "emotion2vec+": Emotion2VecPlusModel,
37
42
  "higgs-audio": HiggsAudioTokenizerModel,
38
43
  "hubert": HuBERTModel,
44
+ "mimi": MimiModel,
39
45
  "next-tdnn": NeXtTDNNModel,
40
46
  "r-spin": RSpinModel,
41
47
  "r-vector": RVectorModel,
42
48
  "redimnet": ReDimNetModel,
49
+ "redimnet2": ReDimNet2Model,
43
50
  "spidr": SpidRModel,
44
51
  "spin": SpinModel,
45
52
  "sslzip": SSLZipModel,
46
53
  "unispeech-sat": UniSpeechSATModel,
54
+ "w2v-bert2": W2VBert2Model,
47
55
  "wav2vec2": Wav2Vec2Model,
48
56
  "wavlm": WavLMModel,
49
57
  "wavlm-sv": WavLMSVModel,
@@ -0,0 +1,176 @@
1
+ # Copyright (c) 2026 Takenori Yoshimura
2
+ # Released under the MIT License.
3
+
4
+ """A module for the DAC-VAE model."""
5
+
6
+ from enum import Enum
7
+
8
+ import torch
9
+ from huggingface_hub import hf_hub_download
10
+
11
+ from ..interfaces.types import Audio, Features
12
+ from ..utils.io import silence_hf_hub
13
+ from ..utils.validation import validate_enum, validate_length
14
+ from .base import TokenLevelFeatureModel
15
+
16
+
17
+ class DACVAEVariant(str, Enum):
18
+ """Enumeration of supported DAC-VAE model variants."""
19
+
20
+ BASE = "base"
21
+
22
+ @property
23
+ def model_name(self) -> str:
24
+ """Return the model name corresponding to the variant.
25
+
26
+ Returns
27
+ -------
28
+ out : str
29
+ The model name corresponding to the variant.
30
+
31
+ """
32
+ return "facebook/dacvae-watermarked"
33
+
34
+
35
+ class DACVAEModel(TokenLevelFeatureModel):
36
+ """A class for the DAC-VAE model.
37
+
38
+ The decoder of the original model is not constructed because only the encoder is
39
+ required to extract features. This also means that the watermarking module, which
40
+ is a part of the decoder, is never used. In addition, the loudness normalization
41
+ performed in the original inference script is not applied.
42
+
43
+ """
44
+
45
+ def __init__(self, variant: str | None = None, device: str = "cpu") -> None:
46
+ """Initialize the DAC-VAE model.
47
+
48
+ Parameters
49
+ ----------
50
+ variant : str | None, optional
51
+ The variant of the model to use.
52
+
53
+ device : str, optional
54
+ The device to run the model on (e.g., 'cpu' or 'cuda').
55
+
56
+ """
57
+ super().__init__(variant, device)
58
+
59
+ self.variant = validate_enum(variant, DACVAEVariant, DACVAEVariant.BASE)
60
+ self._model_id = f"dacvae-{self.variant.value}"
61
+
62
+ def load(self, model_dir: str, quiet: bool = False) -> None:
63
+ """Load the model from the specified directory.
64
+
65
+ Parameters
66
+ ----------
67
+ model_dir : str
68
+ The directory where the model checkpoint will be stored.
69
+
70
+ quiet : bool, optional
71
+ Whether to suppress output during the loading process.
72
+
73
+ Raises
74
+ ------
75
+ RuntimeError
76
+ If the model checkpoint does not contain the expected parameters.
77
+
78
+ """
79
+ if self.model is not None:
80
+ return
81
+
82
+ with silence_hf_hub(quiet):
83
+ model_path = hf_hub_download(
84
+ repo_id=self.variant.model_name,
85
+ filename="weights.pth",
86
+ repo_type="model",
87
+ cache_dir=model_dir,
88
+ )
89
+
90
+ checkpoint = torch.load(
91
+ model_path, map_location=torch.device("cpu"), weights_only=False
92
+ )
93
+
94
+ from lfeats.third_party.dacvae import DACVAE
95
+
96
+ self.model = DACVAE(**checkpoint["metadata"]["kwargs"])
97
+
98
+ # The checkpoint contains the parameters of the decoder, which are not used.
99
+ missing_keys, _ = self.model.load_state_dict(
100
+ checkpoint["state_dict"], strict=False
101
+ )
102
+ if missing_keys:
103
+ raise RuntimeError(f"Missing parameters in the checkpoint: {missing_keys}")
104
+
105
+ self.model.eval()
106
+ self.model.to(self.device)
107
+
108
+ def extract_features_impl(self, audio: Audio, layers: list[int]) -> Features:
109
+ """Extract features from the input audio using the model.
110
+
111
+ Parameters
112
+ ----------
113
+ audio : Audio
114
+ The input audio data with shape (B, T).
115
+
116
+ layers : list[int]
117
+ The layer(s) from which to extract features.
118
+
119
+ Returns
120
+ -------
121
+ out : Features
122
+ The extracted features.
123
+
124
+ Raises
125
+ ------
126
+ RuntimeError
127
+ If the model is not loaded.
128
+
129
+ """
130
+ if self.model is None:
131
+ raise RuntimeError("Model not loaded. Call 'load' method first.")
132
+
133
+ with torch.inference_mode():
134
+ inputs = audio.tensor.to(self.device)
135
+ inputs = validate_length(inputs, self.frame_shift // 2 + 1)
136
+ vectors = self.model.encode(inputs.unsqueeze(1)) # (B, D, N)
137
+ vectors = vectors.transpose(1, 2)
138
+ vectors = vectors[:, : audio.length // self.frame_shift] # due to padding
139
+
140
+ return Features(data=vectors, source=self.model_id)
141
+
142
+ @property
143
+ def center_offset(self) -> int:
144
+ """Get the center offset of the model.
145
+
146
+ Returns
147
+ -------
148
+ out : int
149
+ The center offset in samples.
150
+
151
+ """
152
+ return self.frame_shift // 2
153
+
154
+ @property
155
+ def frame_shift(self) -> int:
156
+ """Get the frame shift of the model.
157
+
158
+ Returns
159
+ -------
160
+ out : int
161
+ The frame shift in samples.
162
+
163
+ """
164
+ return int(40.0 * self.sample_rate / 1000)
165
+
166
+ @property
167
+ def sample_rate(self) -> int:
168
+ """Get the sample rate required by the model.
169
+
170
+ Returns
171
+ -------
172
+ out : int
173
+ The sample rate in Hz.
174
+
175
+ """
176
+ return 48000
@@ -123,6 +123,22 @@ class HiggsAudioTokenizerModel(TokenLevelFeatureModel):
123
123
 
124
124
  return Features(data=vectors, source=self.model_id)
125
125
 
126
+ @property
127
+ def center_offset(self) -> int:
128
+ """Get the center offset of the model.
129
+
130
+ The model concatenates the outputs of the semantic branch (HuBERT) and the
131
+ acoustic branch (DAC encoder), which are delayed by different amounts. Since
132
+ no single offset can align both branches, no compensation is applied.
133
+
134
+ Returns
135
+ -------
136
+ out : int
137
+ The center offset in samples.
138
+
139
+ """
140
+ return 0
141
+
126
142
  @property
127
143
  def frame_shift(self) -> int:
128
144
  """Get the frame shift of the model.
@@ -0,0 +1,161 @@
1
+ # Copyright (c) 2026 Takenori Yoshimura
2
+ # Released under the MIT License.
3
+
4
+ """A module for the Mimi model."""
5
+
6
+ from enum import Enum
7
+ from typing import Any
8
+
9
+ import torch
10
+
11
+ from ..interfaces.types import Audio, Features
12
+ from ..utils.io import setup_transformers
13
+ from ..utils.validation import validate_enum
14
+ from .base import TokenLevelFeatureModel
15
+
16
+
17
+ class MimiVariant(str, Enum):
18
+ """Enumeration of supported Mimi variants."""
19
+
20
+ BASE = "base"
21
+
22
+ @property
23
+ def model_name(self) -> str:
24
+ """Return the model name corresponding to the variant.
25
+
26
+ Returns
27
+ -------
28
+ out : str
29
+ The model name corresponding to the variant.
30
+
31
+ """
32
+ return "kyutai/mimi"
33
+
34
+
35
+ class MimiModel(TokenLevelFeatureModel):
36
+ """A class for the Mimi model."""
37
+
38
+ def __init__(self, variant: str | None = None, device: str = "cpu") -> None:
39
+ """Initialize the Mimi model.
40
+
41
+ Parameters
42
+ ----------
43
+ variant : str | None, optional
44
+ The variant of the model to use.
45
+
46
+ device : str, optional
47
+ The device to run the model on (e.g., 'cpu' or 'cuda').
48
+
49
+ """
50
+ super().__init__(variant, device)
51
+
52
+ self.variant = validate_enum(variant, MimiVariant, MimiVariant.BASE)
53
+ self._model_id = f"mimi-{self.variant.value}"
54
+
55
+ self.feature_extractor = None
56
+
57
+ def load(self, model_dir: str, quiet: bool = False) -> None:
58
+ """Load the model from the specified directory.
59
+
60
+ Parameters
61
+ ----------
62
+ model_dir : str
63
+ The directory where the model checkpoint will be stored.
64
+
65
+ quiet : bool, optional
66
+ Whether to suppress output during the loading process.
67
+
68
+ """
69
+ if self.model is not None:
70
+ return
71
+
72
+ from transformers import AutoFeatureExtractor
73
+ from transformers import MimiModel as _MimiModel
74
+
75
+ with setup_transformers(quiet):
76
+ self.feature_extractor = AutoFeatureExtractor.from_pretrained(
77
+ self.variant.model_name, cache_dir=model_dir
78
+ )
79
+ self.model = _MimiModel.from_pretrained(
80
+ self.variant.model_name, cache_dir=model_dir
81
+ )
82
+ self.model.eval()
83
+ self.model.to(self.device) # type: ignore
84
+
85
+ def extract_features_impl(self, audio: Audio, layers: list[int]) -> Features:
86
+ """Extract features from the input audio using the model.
87
+
88
+ Parameters
89
+ ----------
90
+ audio : Audio
91
+ The input audio data with shape (B, T).
92
+
93
+ layers : list[int]
94
+ The layer(s) from which to extract features.
95
+
96
+ Returns
97
+ -------
98
+ out : Features
99
+ The extracted features.
100
+
101
+ Raises
102
+ ------
103
+ RuntimeError
104
+ If the model is not loaded.
105
+
106
+ """
107
+ if self.feature_extractor is None or self.model is None:
108
+ raise RuntimeError("Model not loaded. Call 'load' method first.")
109
+
110
+ with torch.inference_mode():
111
+ inputs = self.feature_extractor(
112
+ raw_audio=[x for x in audio.array],
113
+ sampling_rate=self.feature_extractor.sampling_rate,
114
+ return_tensors="pt",
115
+ ).to(self.device)
116
+
117
+ encoder_outputs: Any = self.model.encode(
118
+ inputs["input_values"], inputs["padding_mask"]
119
+ )
120
+ indices = encoder_outputs.audio_codes # (B, Q, N)
121
+ vectors = self.model.quantizer.decode(indices) # (B, D, N)
122
+ vectors = vectors.transpose(1, 2)
123
+ vectors = vectors[:, : audio.length // self.frame_shift] # due to padding
124
+
125
+ return Features(data=vectors, source=self.model_id)
126
+
127
+ @property
128
+ def center_offset(self) -> int:
129
+ """Get the center offset of the model.
130
+
131
+ Returns
132
+ -------
133
+ out : int
134
+ The center offset in samples.
135
+
136
+ """
137
+ return self.frame_shift // 2
138
+
139
+ @property
140
+ def frame_shift(self) -> int:
141
+ """Get the frame shift of the model.
142
+
143
+ Returns
144
+ -------
145
+ out : int
146
+ The frame shift in samples.
147
+
148
+ """
149
+ return int(80.0 * self.sample_rate / 1000)
150
+
151
+ @property
152
+ def sample_rate(self) -> int:
153
+ """Get the sample rate required by the model.
154
+
155
+ Returns
156
+ -------
157
+ out : int
158
+ The sample rate in Hz.
159
+
160
+ """
161
+ return 24000