# How to decode wav2vec2 output with beam search?

**URL:** <https://discuss.huggingface.co/t/how-to-decode-wav2vec2-output-with-beam-search/33149>\
**Category:** Beginners\
**Created:** [March 6, 2023, 10:50am UTC](https://discuss.huggingface.co/t/how-to-decode-wav2vec2-output-with-beam-search/33149 "2023-03-06T10:50:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laro1](https://avatars.discourse-cdn.com/v4/letter/l/ad7895/32.png) [@laro1](https://discuss.huggingface.co/u/laro1)\
**Post date:** [March 6, 2023, 10:50am UTC](https://discuss.huggingface.co/t/how-to-decode-wav2vec2-output-with-beam-search/33149/1 "2023-03-06T10:50:16Z")

</div>

I’m running simple wav2vec2 example:

```auto
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
from torchaudio.utils import download_asset

import torch
import librosa

if __name__ == ' __main__':
   processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-base-960h")
   model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")

   FILE_NAME = "tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav"
   SPEECH_FILE = download_asset(FILE_NAME)

   speech, sr = librosa.load(SPEECH_FILE, sr=16000)
   input_values = processor(speech, sampling_rate=16000, return_tensors="pt").input_values
   logits = model(input_values).logits

```

How can I decode the logits with the beam-search algorithm (without using LM) ?
