A comprehensive demonstration of Vogent Turn Detection - a state-of-the-art multimodal turn detection system for voice AI applications.
This repository showcases the capabilities of Vogent Turn, a library that combines audio analysis and conversational context to accurately determine when a speaker has finished their turn in a conversation.
torch.compile for real-time applicationsAudio (16kHz) ──> Whisper Encoder ──> Audio Embeddings
│
▼
Text Context ──> SmolLM Tokenizer ──> Text Embeddings
│
▼
Combined Processing
│
▼
Binary Classification
(Complete / Incomplete)
git clone <your-repo-url>
cd <repo-name>
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate
pip install -r requirements.txt
Or using uv (faster):
uv pip install -r requirements.txt
Run the main demonstration script:
python main.py
This will execute four comprehensive examples:
from vogent_turn import TurnDetector
import soundfile as sf
# Initialize detector
detector = TurnDetector(compile_model=False)
# Load audio
audio, sr = sf.read("audio.wav")
# Detect turn endpoint
result = detector.predict(
audio,
prev_line="What is your phone number",
curr_line="My number is 804",
sample_rate=sr,
return_probs=True
)
print(f"Turn complete: {result['is_endpoint']}")
print(f"Confidence: {result['prob_endpoint']:.1%}")
# Process multiple audio files efficiently
results = detector.predict_batch(
audio_batch,
context_batch=context_batch,
sample_rate=16000,
return_probs=True
)
Accurately detect when users finish speaking to provide timely responses without interrupting.
Example: "Set alarm for..." [CONTINUE] → "...7 AM tomorrow" [COMPLETE]
Enable natural conversation flow by detecting turn boundaries automatically.
Example: "I need help with..." [CONTINUE] → "...my account" [COMPLETE]
Segment conversations accurately by identifying speaker turn boundaries.
Example: Speaker A finishes → [ENDPOINT] → Speaker B begins
Respond with natural timing by understanding conversation flow.
Example: "My name is..." [CONTINUE] → "...John Smith" [COMPLETE] → Bot responds
Evaluate pronunciation and sentence completion in educational applications.
Example: "The cat is..." [CONTINUE] → "...on the table" [COMPLETE]
This repository includes three audio samples for testing and demonstration:
File: incomplete_number_sample.wav (Click to download)
Context: "What is your phone number?" → "My number is 804"
Expected Result: CONTINUE (speaker will continue)
File: incomplete.wav (Click to download)
Context: Partial response
Expected Result: CONTINUE (speaker not finished)
File: complete.wav (Click to download)
Context: "What is your phone number?" → "My number is 8042221111"
Expected Result: ENDPOINT (speaker finished)
These samples demonstrate the model's ability to distinguish between complete and incomplete utterances based on both audio cues (intonation, pauses) and conversational context.
from vogent_turn import TurnDetector
import soundfile as sf
detector = TurnDetector(compile_model=False)
# Test with incomplete sample
audio, sr = sf.read("incomplete_number_sample.wav")
result = detector.predict(
audio,
prev_line="What is your phone number",
curr_line="My number is 804",
sample_rate=sr,
return_probs=True
)
print(f"Incomplete: {result['is_endpoint']}") # Expected: False
# Test with complete sample
audio, sr = sf.read("complete.wav")
result = detector.predict(
audio,
prev_line="What is your phone number",
curr_line="My number is 8042221111",
sample_rate=sr,
return_probs=True
)
print(f"Complete: {result['is_endpoint']}") # Expected: True
.
├── main.py # Main demonstration script
├── tes.py # Additional test examples
├── requirements.txt # Python dependencies
├── README.md # This file
├── incomplete_number_sample.wav # Audio sample: incomplete utterance
├── incomplete.wav # Audio sample: partial response
├── complete.wav # Audio sample: complete utterance
├── vogent-turn/ # Vogent Turn library source
│ ├── vogent_turn/ # Core library code
│ │ ├── __init__.py
│ │ ├── inference.py # TurnDetector class
│ │ ├── predict.py # CLI tool
│ │ ├── smollm_whisper.py # Model architecture
│ │ └── whisper.py # Whisper components
│ ├── examples/ # Usage examples
│ │ ├── basic_usage.py
│ │ ├── batch_processing.py
│ │ └── request_batcher.py
│ ├── pyproject.toml # Package configuration
│ └── README.md # Library documentation
└── venv/ # Virtual environment (not in git)
detector = TurnDetector(
model_name="vogent/Vogent-Turn-80M", # HuggingFace model ID
revision="main", # Model revision
device=None, # "cuda", "cpu", or None (auto)
compile_model=True # Use torch.compile
)
result = detector.predict(
audio, # np.ndarray: (n_samples,) mono float32
prev_line="", # str: Previous speaker's text
curr_line="", # str: Current speaker's text
sample_rate=None, # int: Sample rate in Hz
return_probs=False # bool: Return probabilities
)
Returns:
return_probs=False: bool (True = turn complete)return_probs=True: dict with keys:
is_endpoint: boolprob_endpoint: float (0-1)prob_continue: float (0-1)results = detector.predict_batch(
audio_batch, # list[np.ndarray]: List of audio arrays
context_batch=None, # list[dict]: List of context dicts
sample_rate=None, # int: Sample rate in Hz
return_probs=False # bool: Return probabilities
)
# Run main demonstration
python main.py
# Run additional tests
python tes.py
This project follows Python best practices:
If you use Vogent Turn in your research or project, please cite:
@software{vogent_turn,
title = {Vogent Turn: Multimodal Turn Detection for Conversational AI},
author = {Vogent},
year = {2024},
url = {https://github.com/vogent/vogent-turn}
}
This demonstration code is provided as-is for educational and research purposes.
Vogent Turn library:
See the vogent-turn LICENSE for details.
Contributions are welcome! Please feel free to submit issues or pull requests.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)For issues related to:
Built with Vogent Turn | Powered by AI
6 commits
Python
100.0%
A comprehensive demonstration of Vogent Turn Detection - a state-of-the-art multimodal turn detection system for voice AI applications.
This repository showcases the capabilities of Vogent Turn, a library that combines audio analysis and conversational context to accurately determine when a speaker has finished their turn in a conversation.
torch.compile for real-time applicationsAudio (16kHz) ──> Whisper Encoder ──> Audio Embeddings
│
▼
Text Context ──> SmolLM Tokenizer ──> Text Embeddings
│
▼
Combined Processing
│
▼
Binary Classification
(Complete / Incomplete)
git clone <your-repo-url>
cd <repo-name>
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate
pip install -r requirements.txt
Or using uv (faster):
uv pip install -r requirements.txt
Run the main demonstration script:
python main.py
This will execute four comprehensive examples:
from vogent_turn import TurnDetector
import soundfile as sf
# Initialize detector
detector = TurnDetector(compile_model=False)
# Load audio
audio, sr = sf.read("audio.wav")
# Detect turn endpoint
result = detector.predict(
audio,
prev_line="What is your phone number",
curr_line="My number is 804",
sample_rate=sr,
return_probs=True
)
print(f"Turn complete: {result['is_endpoint']}")
print(f"Confidence: {result['prob_endpoint']:.1%}")
# Process multiple audio files efficiently
results = detector.predict_batch(
audio_batch,
context_batch=context_batch,
sample_rate=16000,
return_probs=True
)
Accurately detect when users finish speaking to provide timely responses without interrupting.
Example: "Set alarm for..." [CONTINUE] → "...7 AM tomorrow" [COMPLETE]
Enable natural conversation flow by detecting turn boundaries automatically.
Example: "I need help with..." [CONTINUE] → "...my account" [COMPLETE]
Segment conversations accurately by identifying speaker turn boundaries.
Example: Speaker A finishes → [ENDPOINT] → Speaker B begins
Respond with natural timing by understanding conversation flow.
Example: "My name is..." [CONTINUE] → "...John Smith" [COMPLETE] → Bot responds
Evaluate pronunciation and sentence completion in educational applications.
Example: "The cat is..." [CONTINUE] → "...on the table" [COMPLETE]
This repository includes three audio samples for testing and demonstration:
File: incomplete_number_sample.wav (Click to download)
Context: "What is your phone number?" → "My number is 804"
Expected Result: CONTINUE (speaker will continue)
File: incomplete.wav (Click to download)
Context: Partial response
Expected Result: CONTINUE (speaker not finished)
File: complete.wav (Click to download)
Context: "What is your phone number?" → "My number is 8042221111"
Expected Result: ENDPOINT (speaker finished)
These samples demonstrate the model's ability to distinguish between complete and incomplete utterances based on both audio cues (intonation, pauses) and conversational context.
from vogent_turn import TurnDetector
import soundfile as sf
detector = TurnDetector(compile_model=False)
# Test with incomplete sample
audio, sr = sf.read("incomplete_number_sample.wav")
result = detector.predict(
audio,
prev_line="What is your phone number",
curr_line="My number is 804",
sample_rate=sr,
return_probs=True
)
print(f"Incomplete: {result['is_endpoint']}") # Expected: False
# Test with complete sample
audio, sr = sf.read("complete.wav")
result = detector.predict(
audio,
prev_line="What is your phone number",
curr_line="My number is 8042221111",
sample_rate=sr,
return_probs=True
)
print(f"Complete: {result['is_endpoint']}") # Expected: True
.
├── main.py # Main demonstration script
├── tes.py # Additional test examples
├── requirements.txt # Python dependencies
├── README.md # This file
├── incomplete_number_sample.wav # Audio sample: incomplete utterance
├── incomplete.wav # Audio sample: partial response
├── complete.wav # Audio sample: complete utterance
├── vogent-turn/ # Vogent Turn library source
│ ├── vogent_turn/ # Core library code
│ │ ├── __init__.py
│ │ ├── inference.py # TurnDetector class
│ │ ├── predict.py # CLI tool
│ │ ├── smollm_whisper.py # Model architecture
│ │ └── whisper.py # Whisper components
│ ├── examples/ # Usage examples
│ │ ├── basic_usage.py
│ │ ├── batch_processing.py
│ │ └── request_batcher.py
│ ├── pyproject.toml # Package configuration
│ └── README.md # Library documentation
└── venv/ # Virtual environment (not in git)
detector = TurnDetector(
model_name="vogent/Vogent-Turn-80M", # HuggingFace model ID
revision="main", # Model revision
device=None, # "cuda", "cpu", or None (auto)
compile_model=True # Use torch.compile
)
result = detector.predict(
audio, # np.ndarray: (n_samples,) mono float32
prev_line="", # str: Previous speaker's text
curr_line="", # str: Current speaker's text
sample_rate=None, # int: Sample rate in Hz
return_probs=False # bool: Return probabilities
)
Returns:
return_probs=False: bool (True = turn complete)return_probs=True: dict with keys:
is_endpoint: boolprob_endpoint: float (0-1)prob_continue: float (0-1)results = detector.predict_batch(
audio_batch, # list[np.ndarray]: List of audio arrays
context_batch=None, # list[dict]: List of context dicts
sample_rate=None, # int: Sample rate in Hz
return_probs=False # bool: Return probabilities
)
# Run main demonstration
python main.py
# Run additional tests
python tes.py
This project follows Python best practices:
If you use Vogent Turn in your research or project, please cite:
@software{vogent_turn,
title = {Vogent Turn: Multimodal Turn Detection for Conversational AI},
author = {Vogent},
year = {2024},
url = {https://github.com/vogent/vogent-turn}
}
This demonstration code is provided as-is for educational and research purposes.
Vogent Turn library:
See the vogent-turn LICENSE for details.
Contributions are welcome! Please feel free to submit issues or pull requests.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)For issues related to:
Built with Vogent Turn | Powered by AI
6 commits
Python
100.0%