when i try using a turn detector model on windows,...
# ask-ai
b
when i try using a turn detector model on windows, it throws errors. i have these imports from livekit.plugins.turn_detector.english import EnglishModel from livekit.plugins.turn_detector.multilingual import MultilingualModel and this activation session = AgentSession( userdata=HermesUserData( ctx=ctx, session_id=session_id, caller_phone=caller_phone ), stt=google.STT( model="latest_short", spoken_punctuation=False, interim_results=False, languages=["en-IN", "hi-IN", "kn-IN"], detect_language=True, punctuate=False, ), llm=google.LLM( model="gemini-2.0-flash", temperature=0.5, vertexai=True, project="alchemic-shetty", location="global", ), tts=google.TTS( language="en-IN", gender="female", voice_name="en-IN-Chirp3-HD-Aoede" ), vad=silero.VAD.load(), turn_detection=EnglishModel(), max_tool_steps=10, max_endpointing_delay=0.5, ) it throws this error. Can you tell me whats wrong? 2025-08-30 184139,418 - DEBUG livekit.agents - initializing inference runner {"runner": "lk_end_of_utterance_en", "pid": 11304, "inference": true} 2025-08-30 184145 INFO livekit.agents killing process 2025-08-30 184145,591 - INFO livekit.agents - killing process {"pid": 11304, "inference": true} 2025-08-30 184145 ERROR livekit.agents worker failed Traceback (most recent call last): File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\tasks.py", line 510, in wait_for return await fut ^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\ipc\channel.py", line 47, in arecv_message return _read_message(await dplx.recv_bytes(), messages) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 35, in recv_bytes len_bytes = await self._reader.readexactly(4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 734, in readexactly await self._wait_for_data('readexactly') File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 527, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\cli\_run.py", line 79, in _worker_run await worker.run() File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\worker.py", line 403, in run await self._inference_executor.initialize() File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\ipc\supervised_proc.py", line 169, in initialize init_res = await asyncio.wait_for( ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\tasks.py", line 509, in wait_for async with timeouts.timeout(timeout): File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\timeouts.py", line 111, in aexit raise TimeoutError from exc_val TimeoutError 2025-08-30 184145,591 - ERROR livekit.agents - worker failed Traceback (most recent call last): File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\tasks.py", line 510, in wait_for return await fut ^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\ipc\channel.py", line 47, in arecv_message return _read_message(await dplx.recv_bytes(), messages) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 35, in recv_bytes len_bytes = await self._reader.readexactly(4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 734, in readexactly await self._wait_for_data('readexactly') File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 527, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\cli\_run.py", line 79, in _worker_run await worker.run() File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\worker.py", line 403, in run await self._inference_executor.initialize() File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\ipc\supervised_proc.py", line 169, in initialize init_res = await asyncio.wait_for( ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\tasks.py", line 509, in wait_for async with timeouts.timeout(timeout): File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\timeouts.py", line 111, in aexit raise TimeoutError from exc_val TimeoutError 2025-08-30 184145 ERROR livekit.agents Error in _read_ipc_task Traceback (most recent call last): File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 35, in recv_bytes len_bytes = await self._reader.readexactly(4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 732, in readexactly raise exceptions.IncompleteReadError(incomplete, n) asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 4 expected bytes The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\cli\watcher.py", line 120, in _read_ipc_task msg = await channel.arecv_message(self._pch, proto.IPC_MESSAGES) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\ipc\channel.py", line 47, in arecv_message return _read_message(await dplx.recv_bytes(), messages) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 43, in recv_bytes raise DuplexClosed() from e livekit.agents.utils.aio.duplex_unix.DuplexClosed 2025-08-30 184145,602 - ERROR livekit.agents - Error in _read_ipc_task Traceback (most recent call last): File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 35, in recv_bytes len_bytes = await self._reader.readexactly(4) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aryaa\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 732, in readexactly raise exceptions.IncompleteReadError(incomplete, n) asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 4 expected bytes The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\cli\watcher.py", line 120, in _read_ipc_task msg = await channel.arecv_message(self._pch, proto.IPC_MESSAGES) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\ipc\channel.py", line 47, in arecv_message return _read_message(await dplx.recv_bytes(), messages) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Aryaan\Work\Business\Current Businesses\Chatbot\Final\livekit-1\venv\Lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 43, in recv_bytes raise DuplexClosed() from e livekit.agents.utils.aio.duplex_unix.DuplexClosed
t
Thanks for reaching out, Aryan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The error logs seem to point to a possible hiccup with initializing the inference runner or loading the model. Just to double-check, did you download the necessary model weights using the command python my_agent.py download-files? Also, were there any particular steps or settings you tried before this error popped up? I'm here to help figure this out with you! Sources: LiveKit turn detector plugin | LiveKit Docs | livekit-plugins/livekit-plugins-turn-detector/README.md | agents/src/voice/audio_recognition.ts
b
i have downloaded the files multiple times. I tried changing the imports, changing from english to multilingual and back to english nothing worked
t
It looks like the TimeoutError during inference initialization might be due to some hiccups with the environment or resource availability. No worries though—here are a few friendly steps to help you troubleshoot: 1. Make sure the Model Files Are Pre-Downloaded: Try running
python your_agent.py download-files
to confirm all the necessary model weights are ready and waiting on your system. 2. Choose the Right Compute Resources: Burstable instances like AWS t3 or t4 can sometimes slow things down by throttling CPU performance. If possible, go for compute-optimized instances like c5 or c6i for smoother sailing. 3. Keep an Eye on CPU Performance: If you’re using burstable instances, check whether CPU throttling or running out of credits might be causing delays in loading the model. 4. Check the Inference Runtime: Typically, the multilingual model should initialize within 50–160ms. If it’s taking longer, that could be a sign of resource constraints. 5. ONNX Runtime Settings: The plugin already uses optimized ONNX Runtime configurations, so no need to tweak anything manually. Just double-check that your environment supports these settings. Does this help clear things up? If not, feel free to share a bit more about your setup—like the instance type or CPU usage—and we’ll figure it out together! Sources: plugins/livekit/src/turn_detector/multilingual.ts | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS | LiveKit turn detector plugin | LiveKit Docs | livekit-plugins/livekit-plugins-turn-detector/livekit/plugins/turn_detector...
b
it running locally. The files are downloaded, i have no throttling. CPU is available. How do i check inference runtime
t
Here’s how you can measure the inference runtime for the LiveKit turn detector model locally—just follow these simple steps: 1. Enable Debug Logging: Pop this code into your script to capture detailed logs, including the inference runtime:
Copy code
import logging
logging.basicConfig(level=logging.DEBUG)
2. Run the Agent: Go ahead and run your agent like you normally would. Just make sure the model weights are downloaded and everything’s set up correctly. 3. Keep an Eye on the Logs: Watch out for log entries with the message
eou prediction
. Those will show a
duration
value—that’s your inference runtime in seconds. Usually, you’ll see inference latency around ~15–45 ms for the English model and ~50–160 ms for the Multilingual model. If you hit any bumps or have questions, just give me a shout—I’m here to help! Sources: LiveKit turn detector plugin | LiveKit Docs | livekit-plugins/livekit-plugins-turn-detector/livekit/plugins/turn_detector... | agents/src/voice/audio_recognition.ts
b
Lets leave the logiing and inference runtime for now. How do i make it work?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!