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.
This commit is contained in:
@@ -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())]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user