Skip to main content

Arabic End-of-Utterance detection for LiveKit using MARBERT

Project description

LiveKit MARBERT Turn Detector

Arabic End-of-Utterance detection plugin for LiveKit Agents using fine-tuned MARBERT.

Installation

pip install livekit-plugins-marbert

Or install from source:

pip install git+https://github.com/azeddinshr/livekit-plugins-marbert.git

Quick Start

from livekit.plugins.marbert import MarbertTurnDetector
from livekit.agents import Agent, AgentSession, JobContext, JobProcess, WorkerOptions, cli
from livekit.plugins import openai, silero

def prewarm(proc: JobProcess):
    """Load models once at startup (recommended for production)."""
    proc.userdata["vad"] = silero.VAD.load()
    proc.userdata["marbert"] = MarbertTurnDetector(
        model_name="azeddinShr/marbert-arabic-eou",
        device="cpu"
    )

async def entrypoint(ctx: JobContext):
    await ctx.connect()
    
    session = AgentSession(
        stt=openai.STT(model="gpt-4o-transcribe", language="ar"),
        llm=openai.LLM(model="gpt-4o-mini"),
        tts=openai.TTS(model="gpt-4o-mini-tts"),
        vad=ctx.proc.userdata["vad"],
        turn_detection=ctx.proc.userdata["marbert"]
    )
    
    agent = Agent(instructions="أنت مساعد سعودي ذكي")
    await session.start(agent=agent, room=ctx.room)

if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))

See examples/basic_usage.py for a complete working example.

Features

  • ✅ Fine-tuned on 125K Arabic utterances (SADA22 dataset)
  • ✅ Specialized for Saudi dialect
  • ✅ 77% F1 score, 30ms average CPU latency
  • ✅ Drop-in replacement for LiveKit turn detector
  • ✅ Compatible with LiveKit Agents 1.3.9+
  • ✅ Production-ready with prewarm support

Performance

Metric MARBERT LiveKit Multilingual
F1 Score 0.77 0.66*
Latency (CPU) 30ms 300ms*
Language Arabic (Saudi) 14 languages
Model Size 163M params 500M params

*Comparison with community Arabic model

Model Details

Configuration

MarbertTurnDetector(
    model_name="azeddinShr/marbert-arabic-eou",  # HuggingFace model ID
    threshold=0.5,                                 # EOU probability threshold
    device="cpu"                                   # "cpu" or "cuda"
)

Requirements

  • Python >= 3.9
  • livekit-agents >= 1.3.9
  • transformers >= 4.30.0
  • torch >= 2.0.0

License

Apache 2.0

Citation

If you use this model in your research, please cite:

@misc{marbert-arabic-eou,
  author = {Sahir, Azeddin},
  title = {MARBERT Arabic End-of-Utterance Detection},
  year = {2025},
  publisher = {GitHub},
  url = {https://github.com/azeddinshr/livekit-plugins-marbert}
}

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_marbert-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livekit_plugins_marbert-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_marbert-0.1.0.tar.gz.

File metadata

  • Download URL: livekit_plugins_marbert-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for livekit_plugins_marbert-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c23092d8598f7347ea9d38d51e6183f5167cd151392b5a91ec2863989db52c0e
MD5 bbc08561b24131e993afc1ef3be63c60
BLAKE2b-256 36456995ec7dfd337f635d80ec5780bd43b24165ce7496c3792261b52cffd59f

See more details on using hashes here.

File details

Details for the file livekit_plugins_marbert-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_marbert-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e007a972818fa20e9a02bf5029668f182dd4a2bda24d9783d0acc9bc6d4ee4cf
MD5 3e970eb9bc9138b0e8e45c563a5bf088
BLAKE2b-256 0f1afef8e46f0299ab5144bbfa8be97772145118c9ca86e7aa0b994502cc32fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page