
# Hubert-XLarge-ls960-ft + 4-gram

This model is identical to [Facebook's hubert-xlarge-ls960-ft](https://huggingface.co/facebook/hubert-xlarge-ls960-ft), but is 
augmented with an English 4-gram. The `4-gram.arpa.gz` of [Librispeech's official ngrams](https://www.openslr.org/11) is used.
 
 ## Evaluation
 
 This code snippet shows how to evaluate **patrickvonplaten/hubert-xlarge-ls960-ft-4-gram** on LibriSpeech's "clean" and "other" test data.
 
```python
from datasets import load_dataset
from transformers import AutoModelForCTC, AutoProcessor
import torch
from jiwer import wer

model_id = "patrickvonplaten/hubert-xlarge-ls960-ft-4-gram"

librispeech_eval = load_dataset("librispeech_asr", "other", split="test")

model = AutoModelForCTC.from_pretrained(model_id).to("cuda")
processor = AutoProcessor.from_pretrained(model_id)

def map_to_pred(batch):
    inputs = processor(batch["audio"]["array"], sampling_rate=16_000, return_tensors="pt")

    inputs = {k: v.to("cuda") for k,v in inputs.items()}

    with torch.no_grad():
        logits = model(**inputs).logits

    transcription = processor.batch_decode(logits.cpu().numpy()).text[0]
    batch["transcription"] = transcription
    return batch

result = librispeech_eval.map(map_to_pred, remove_columns=["audio"])

print(wer(result["text"], result["transcription"]))
```

*Result (WER)*:

| "clean" | "other" |
|---|---|
| 1.71 | 3.06 |
{"language": "en", "license": "apache-2.0", "tags": ["audio", "automatic-speech-recognition", "hf-asr-leaderboard"], "datasets": ["librispeech_asr"], "widget": [{"example_title": "Librispeech sample 1", "src": "https://cdn-media.huggingface.co/speech_samples/sample1.flac"}, {"example_title": "Librispeech sample 2", "src": "https://cdn-media.huggingface.co/speech_samples/sample2.flac"}], "model-index": [{"name": "patrickvonplaten/hubert-xlarge-ls960-ft-4-gram", "results": [{"task": {"type": "automatic-speech-recognition", "name": "Automatic Speech Recognition"}, "dataset": {"name": "LibriSpeech (clean)", "type": "librispeech_asr", "config": "clean", "split": "test", "args": {"language": "en"}}, "metrics": [{"type": "wer", "value": 1.71, "name": "Test WER"}]}, {"task": {"type": "automatic-speech-recognition", "name": "Automatic Speech Recognition"}, "dataset": {"name": "LibriSpeech (other)", "type": "librispeech_asr", "config": "other", "split": "test", "args": {"language": "en"}}, "metrics": [{"type": "wer", "value": 3.06, "name": "Test WER"}]}]}]}
transformers pytorch hubert automatic-speech-recognition audio hf-asr-leaderboard en dataset:librispeech_asr license:apache-2.0 model-index endpoints_compatible has_space region:us
TAGS
#transformers #pytorch #hubert #automatic-speech-recognition #audio #hf-asr-leaderboard #en #dataset-librispeech_asr #license-apache-2.0 #model-index #endpoints_compatible #has_space #region-us 

Hubert-XLarge-ls960-ft + 4-gram
===============================


This model is identical to Facebook's hubert-xlarge-ls960-ft, but is
augmented with an English 4-gram. The 'URL' of Librispeech's official ngrams is used.


Evaluation
----------


This code snippet shows how to evaluate patrickvonplaten/hubert-xlarge-ls960-ft-4-gram on LibriSpeech's "clean" and "other" test data.


*Result (WER)*:




TAGS
#transformers #pytorch #hubert #automatic-speech-recognition #audio #hf-asr-leaderboard #en #dataset-librispeech_asr #license-apache-2.0 #model-index #endpoints_compatible #has_space #region-us 

passage: TAGS
#transformers #pytorch #hubert #automatic-speech-recognition #audio #hf-asr-leaderboard #en #dataset-librispeech_asr #license-apache-2.0 #model-index #endpoints_compatible #has_space #region-us 
