💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Conditionally import soundfile
davidmezzetti8b7c8f719dce
diff --git a/src/python/txtai/pipeline/transcription.py b/src/python/txtai/pipeline/transcription.pyindex 38176648..9c59f64b 100644--- a/src/python/txtai/pipeline/transcription.py+++ b/src/python/txtai/pipeline/transcription.py@@ -2,7 +2,12 @@Transcription module"""-import soundfile as sf+try:+ import soundfile as sf++ SOUNDFILE = True+except (ImportError, OSError):+ SOUNDFILE = Falsefrom transformers import Wav2Vec2ForCTC, Wav2Vec2Processor@@ -30,6 +35,9 @@ class Transcription(HFModel):# Call parent constructorsuper().__init__(path, quantize, gpu, batch)+ if not SOUNDFILE:+ raise ImportError("SoundFile library not installed or libsndfile not found")+# load model and processorself.model = Wav2Vec2ForCTC.from_pretrained(self.path)self.processor = Wav2Vec2Processor.from_pretrained(self.path)