Skip to content
TheChatArchiveThe Chat Archive
Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written)Hugging Face OpenAssistant Conversations (oasst2)

What open source speech to text libraries would you suggest?

In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
  1. User

    What open source speech to text libraries would you suggest?

  2. Assistant

    Wav2Vec2 is a popular model for speech to text by Meta (formerly Facebook) that is available on open source platforms such as Huggingface and Github.

    In Python, you can start using this model with the "transformers" model from Huggingface:

     from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
     from datasets import load_dataset
     import torch
     
     # load model and tokenizer
     processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-base-960h")
     model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")
         
     # load dummy dataset and read soundfiles
     ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
     
     # tokenize
     input_values = processor(ds[0]["audio"]["array"], return_tensors="pt", padding="longest").input_values  # Batch size 1
     
     # retrieve logits
     logits = model(input_values).logits
     
     # take argmax and decode
     predicted_ids = torch.argmax(logits, dim=-1)
     transcription = processor.batch_decode(predicted_ids)
    

    However, if you want a lighter weight model or want to use a different platform, you may have to find other solutions.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.