# Description This dataset is a subset of [https://huggingface.co/datasets/librispeech_asr](LibriSpeech) that has been adversarially modified. It is designed to fool ASR models into predicting a target of our choosing instead of the correct output. ## Splits The dataset contains several splits. Each split consists of the same utterances, modified with different types and amount of noise. 3 noises have been used: * Adversarial noise of radius 0.04 (`adv_0.04` split) * Adversarial noise of radius 0.015 (`adv_0.015` split) * Adversarial noise of radius 0.015 combined with Room Impulse Response (RIR) noise (`adv_0.015_RIR` split) In addition we provide the original inputs (`natural` split) For each noise we actually provide a split labeled with the original or "natural" correct transcriptions, and one labeled with our selected "target" transcriptions. For instance, the split contains the modified original transcription, while the An ASR model that this dataset fools would get a low target WER and a high natural WER. An ASR model robust to this dataset would get a low natural WER and a high target WER. Therefore we provide in total 8 splits: * `natural_nat_txt` * `natural_tgt_txt` * `adv_0.04_nat_txt` * `adv_0.04_tgt_txt` * `adv_0.015_nat_txt` * `adv_0.015_tgt_txt` * `adv_0.015_RIR_nat_txt` * `adv_0.015_RIR_tgt_txt` ## Usage You should evaluate your model on this dataset as you would evaluate it on LibriSpeech. Here is an example with Wav2Vec2 ```python from datasets import load_dataset from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor import torch from jiwer import wer librispeech_adv_eval = load_dataset("RaphaelOlivier/librispeech_asr_adversarial", "adv", split="adv_0.15_adv_txt") model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h").to("cuda") processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-base-960h") def map_to_pred(batch): input_values = processor(batch["audio"]["array"], return_tensors="pt", padding="longest").input_values with torch.no_grad(): logits = model(input_values.to("cuda")).logits predicted_ids = torch.argmax(logits, dim=-1) transcription = processor.batch_decode(predicted_ids) batch["transcription"] = transcription return batch result = librispeech_adv_eval.map(map_to_pred, batched=True, batch_size=1, remove_columns=["audio"]) print("WER:", wer(result["text"], result["transcription"])) ``` *Result (WER)*: | "0.015 target text" | "0.015 natural text" | "0.04 target text" | "0.04 natural text" |---|---|---|---| | 58.2 | 108 | 49.5 | 108 |