From 9110e9f30b159dcce2f486c2a42cda2d9439f018 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Fri, 20 Feb 2026 16:31:39 -0700 Subject: [PATCH] Lazy import LocalSmartTurnAnalyzerV3 to avoid unnecessary transformers load Move the LocalSmartTurnAnalyzerV3 import from module level into __post_init__ so that importing user_turn_strategies no longer eagerly loads the transformers package. This eliminates the spurious PyTorch was not found warning for users who don't use the smart turn analyzer. --- src/pipecat/turns/user_turn_strategies.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pipecat/turns/user_turn_strategies.py b/src/pipecat/turns/user_turn_strategies.py index 0435f141c..c45a16c40 100644 --- a/src/pipecat/turns/user_turn_strategies.py +++ b/src/pipecat/turns/user_turn_strategies.py @@ -9,7 +9,6 @@ from dataclasses import dataclass from typing import List, Optional -from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3 from pipecat.turns.user_start import ( BaseUserTurnStartStrategy, ExternalUserTurnStartStrategy, @@ -47,6 +46,10 @@ class UserTurnStrategies: if not self.start: self.start = [VADUserTurnStartStrategy(), TranscriptionUserTurnStartStrategy()] if not self.stop: + from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import ( + LocalSmartTurnAnalyzerV3, + ) + self.stop = [TurnAnalyzerUserTurnStopStrategy(turn_analyzer=LocalSmartTurnAnalyzerV3())]