do we have a plugin for faster-whisper ?? <https:...
# ask-ai
h
do we have a plugin for faster-whisper ?? https://github.com/SYSTRAN/faster-whisper Or are there any other locally run STT model that I can use in livekit pipeline.?
t
Thanks for reaching out, Abhishek. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just a quick heads-up: LiveKit doesn’t come with built-in support for faster-whisper or other locally run STT models right out of the box. But don’t worry—it does offer a way to plug them in through custom STT nodes within the LiveKit Agents ecosystem. LiveKit already works smoothly with several cloud-based STT providers like OpenAI and Groq, though it hasn’t yet added direct support for running models like faster-whisper locally. That said, the team is definitely interested in exploring self-hosted Whisper models to help cut down on latency and reduce reliance on external services. If you want to use a locally run model like faster-whisper, you can create a custom STT node using the LiveKit Agents framework. This means building a class that follows the STT protocol, handling real-time audio input, running the local model to transcribe, and streaming the text back into LiveKit’s pipeline. Would you like me to walk you through a step-by-step guide or share a code template to get your custom STT node up and running with faster-whisper? Just let me know—I’m here to help! Sources: fal STT integration guide | LiveKit Docs | Cartesia STT integration guide | LiveKit Docs | OpenAI STT integration guide | LiveKit Docs | Live Conversations with AI using ChatGPT and WebRTC | Speech-to-text (STT) integrations | LiveKit Docs
🙌 1
h
yes please
t
Here’s a friendly, step-by-step guide to help you create a custom STT node in the LiveKit Agents framework for integrating a locally run STT model like faster-whisper: 1. Set Up the LiveKit Agents Framework: Make sure you have the LiveKit Agents framework installed and configured. This will be the foundation for your custom STT node. You can check out the STT node documentation for all the setup details. 2. Implement the STT Node Interface: Create a new class that implements the STT protocol or abstract base class. This class will take care of handling audio input, processing it with the faster-whisper model, and returning the transcriptions. 3. Handle Real-Time Audio Input: Use the LiveKit WebRTC pipeline to capture audio tracks. Your STT node should process these tracks in real-time, converting them into the right format for the faster-whisper model. 4. Integrate the Faster-Whisper Model: Use the faster-whisper library to load your model and run inference. Here’s a quick example in Python:
Copy code
from faster_whisper import Whisper

model = Whisper("path_to_model")

# Process audio frames
def transcribe(audio):
    segments, info = model.transcribe(audio, beam_size=5)
    for segment in segments:
        yield segment.text
5. Stream Transcriptions Back: Send transcription events from your STT node back into the LiveKit pipeline. This way, the transcribed text is ready to be used downstream or displayed. 6. Test and Deploy: Give your custom STT node a thorough test to make sure it handles real-time audio smoothly and gives accurate transcriptions. Once you're happy with it, go ahead and deploy it in your LiveKit environment. If you want any help with these steps or need a more detailed code example, just let me know—I’m here to help!
h
should I modify the STT node or write a plugin for faster whisper
t
To get faster-whisper working with LiveKit, the best way is to create a custom STT node instead of building a full plugin. The LiveKit Agents framework makes this pretty straightforward by letting you override the
stt_node()
method in your own
Agent
subclass. This way, you can plug in faster-whisper as your STT provider without the extra hassle of a plugin. Here’s a simple plan to get you started: 1. Create a Custom Agent Class: Override the
stt_node()
method so it can handle audio input and transcription. 2. Process Audio Input: Take the incoming audio streams and do any prep work if needed (like noise filtering or converting formats). 3. Run Faster-Whisper: Use the faster-whisper library to transcribe the audio in real-time, making sure the output matches LiveKit’s
stt.SpeechEvent
format. 4. Stream Transcriptions: Send those transcription events back into LiveKit’s pipeline so they can be used or displayed downstream. Building a plugin is really only necessary if you want to reuse this integration across different projects or share it with others. For most cases, tweaking the
stt_node
directly is easier and gives you full control over how transcription works. If you want, I’d be happy to share a detailed code example for the
stt_node()
method using faster-whisper. Just let me know how I can help! Sources: Live Conversations with AI using ChatGPT and WebRTC | Groq STT integration guide | LiveKit Docs | plugins/openai/src/stt.ts | Pipeline nodes and hooks | LiveKit Docs | Docs::Agents