Compare commits

...

2 Commits

Author SHA1 Message Date
Mark Backman
bd4596570c Changelog entry for lazy import fix 2026-02-20 16:35:17 -07:00
Mark Backman
9110e9f30b 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.
2026-02-20 16:31:39 -07:00
2 changed files with 5 additions and 1 deletions

1
changelog/3790.fixed.md Normal file
View File

@@ -0,0 +1 @@
- Fixed spurious "PyTorch was not found" warning on startup by lazy-importing `LocalSmartTurnAnalyzerV3` in `UserTurnStrategies`.

View File

@@ -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())]