rd_hubert / README.md
Hguimaraes's picture
Update README.md
3d7d815 verified
metadata
license: cc-by-sa-4.0
pipeline_tag: feature-extraction
tags:
  - speech
  - automatic-speech-recognition
library_name: transformers
language:
  - en

RobustDistiller: Compressing Universal Speech Representations for Enhanced Environment Robustness

Self-supervised speech pre-training enables deep neural network models to capture meaningful and disentangled factors from raw waveform signals. The learned universal speech representations can then be used across numerous downstream tasks. These representations, however, are sensitive to distribution shifts caused by environmental factors, such as noise and/or room reverberation. Their large sizes, in turn, make them unfeasible for edge applications. In this work, we propose a knowledge distillation methodology termed RobustDistiller which compresses universal representations while making them more robust against environmental artifacts via a multi-task learning objective. The proposed layer-wise distillation recipe is evaluated on top of three well-established universal representations, as well as with three downstream tasks. Experimental results show the proposed methodology applied on top of the WavLM Base+ teacher model outperforming all other benchmarks across noise types and levels, as well as reverberation times. Oftentimes, the obtained results with the student model (24M parameters) achieved results inline with those of the teacher model (95M).

tl;dr: Robust distillation recipe for self-supervised speech representation learning (S3RL) models that tackle jointly model compression and robustness against environmental artifacts (noise and reverberation).


Versions

RobustDistiller was originally proposed on our ICASSP paper, which can be found in this link. RobustDistiller is a framework on top of common distillation recipe (e.g., DistilHuBERT).

An extension of this work was made available at Arxiv, where we further expand the work to 12 downstream tasks. In addition, we apply the RobustDistiller on top of the DPHuBERT recipe.


Checkpoints

Model Parameters #Layers Teacher Checkpoint
RD (WavLM) 27M 2 WavLM link
RD (HuBERT) 27M 2 HuBERT link
RD (Robust HuBERT) 27M 2 Robust HuBERT link
RD (DPWavLM) 27M 12 WavLM link

🚀 How To Use

Installation

pip install -U transformers

Load Model and Extract Features

import torch
import torchaudio
from transformers import AutoModel
# Load pre-trained model
model = AutoModel.from_pretrained("Hguimaraes/rd_wavlm", trust_remote_code=True).cuda().eval()
# Load audio and resample to 16kHz
wav, sr = torchaudio.load_audio("path/to/audio")  # (batch_size, wav_len)
wav = torchaudio.functional.resample(wav, sr, 16000)
# Extract features
with torch.no_grad():
    output = model(wav)
# output["last_hidden_states"]: final output (batch_size, seq_len, encoder_dim)
# output["hidden_states"]:      list of elements with (batch_size, seq_len, encoder_dim) tensors (features for each layer or projections)

📖 Citation

@inproceedings{guimaraes2023robustdistiller,
  title={RobustDistiller: Compressing Universal Speech Representations for Enhanced Environment Robustness},
  author={Guimarães, Heitor R and Pimentel, Arthur and Avila, Anderson R and Rezagholizadeh, Mehdi and Chen, Boxing and Falk, Tiago H},
  booktitle={ICASSP 2023-2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
  pages={1--5},
  year={2023},
  organization={IEEE}
}
@article{guimaraes2024efficient,
  title={An Efficient End-to-End Approach to Noise Invariant Speech Features via Multi-Task Learning},
  author={Guimar{\~a}es, Heitor R and Pimentel, Arthur and Avila, Anderson R and Rezagholizadeh, Mehdi and Chen, Boxing and Falk, Tiago H},
  journal={arXiv preprint arXiv:2403.08654},
  year={2024}
}

Acknowledgement

Much of our code base is based on the following repositories:

Thank you so much to the authors!