Audio Classification
Transformers
ONNX
Safetensors
English
dualturn_endpointing
feature-extraction
turn-taking
endpointing
end-of-turn
voice-activity-detection
voice-agents
conversation
speech
audio
mimi
dualturn
real-time
custom_code
Instructions to use anyreach-ai/dualturn-endpointing with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use anyreach-ai/dualturn-endpointing with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("audio-classification", model="anyreach-ai/dualturn-endpointing", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("anyreach-ai/dualturn-endpointing", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload configuration_dualturn.py with huggingface_hub
Browse files- configuration_dualturn.py +50 -0
configuration_dualturn.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class DualTurnConfig(PretrainedConfig):
|
| 5 |
+
"""Configuration for DualTurnModel.
|
| 6 |
+
|
| 7 |
+
The backbone is a two-stream transformer (TurnTakingModel) that encodes
|
| 8 |
+
dual-channel audio via Mimi and predicts per-frame turn-taking signals.
|
| 9 |
+
|
| 10 |
+
The endpoint classifier is a lightweight sklearn model (logistic regression
|
| 11 |
+
or gradient boosting) that converts the 10 backbone signals at a VAD-offset
|
| 12 |
+
anchor into P(ST) β probability the user has finished their turn.
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
model_type = "dualturn"
|
| 16 |
+
|
| 17 |
+
def __init__(
|
| 18 |
+
self,
|
| 19 |
+
# ββ Backbone ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 20 |
+
backbone_input_mode: str = "continuous", # "continuous" | "discrete"
|
| 21 |
+
mimi_sample_rate: int = 24_000, # Mimi encoder input SR
|
| 22 |
+
mimi_frame_rate: float = 12.5, # frames per second
|
| 23 |
+
mimi_frame_ms: float = 80.0, # ms per frame
|
| 24 |
+
# ββ Signals βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 25 |
+
signal_keys: list = None,
|
| 26 |
+
# ββ Endpoint classifier βββββββββββββββββββββββββββββββββββββββββββ
|
| 27 |
+
st_threshold: float = 0.30,
|
| 28 |
+
vad_edge_threshold: float = 0.50, # vad_user edge for anchor
|
| 29 |
+
agent_voice_min: float = 0.15, # min agent VAD to consider voicing
|
| 30 |
+
fvad_alpha_short: float = 0.3, # Silero smoothing (fast)
|
| 31 |
+
fvad_alpha_long: float = 0.7, # Silero smoothing (slow)
|
| 32 |
+
**kwargs,
|
| 33 |
+
):
|
| 34 |
+
super().__init__(**kwargs)
|
| 35 |
+
self.backbone_input_mode = backbone_input_mode
|
| 36 |
+
self.mimi_sample_rate = mimi_sample_rate
|
| 37 |
+
self.mimi_frame_rate = mimi_frame_rate
|
| 38 |
+
self.mimi_frame_ms = mimi_frame_ms
|
| 39 |
+
self.signal_keys = signal_keys or [
|
| 40 |
+
"vad_user", "vad_agent",
|
| 41 |
+
"eot_user", "eot_agent",
|
| 42 |
+
"bot_user", "bot_agent",
|
| 43 |
+
"fvad_user_short", "fvad_user_long",
|
| 44 |
+
"fvad_agent_short", "fvad_agent_long",
|
| 45 |
+
]
|
| 46 |
+
self.st_threshold = st_threshold
|
| 47 |
+
self.vad_edge_threshold = vad_edge_threshold
|
| 48 |
+
self.agent_voice_min = agent_voice_min
|
| 49 |
+
self.fvad_alpha_short = fvad_alpha_short
|
| 50 |
+
self.fvad_alpha_long = fvad_alpha_long
|