Skip to main content

Arabic End-of-Utterance detection for LiveKit using MARBERT

Project description

LiveKit MARBERT Turn Detector

PyPI version Python License

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.1.tar.gz (5.0 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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: livekit_plugins_marbert-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 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.1.tar.gz
Algorithm Hash digest
SHA256 4990641dd3dd37dda085ea0834239e3aef54b88db38ce8638d85c464059dac8e
MD5 23ecd4acc43f00e53808241fcd1d5183
BLAKE2b-256 60bda9599c2e9bba1918b145d7f65bd32fd18989b4411b3922451ac25ba937f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for livekit_plugins_marbert-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 30e39d7a2aa36900213637fcbc088d68d4fa62dfd831e457790f6d58886a76df
MD5 80ba83414ebee6782cb9dab5b1629bd7
BLAKE2b-256 6d608fc1834e6d413fb5500c5da819816bc64f4a1c379f88e1fc7b611750986e

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