Skip to content

Commit 0908a65

Browse files
committedSep 3, 2024·
Update CI & test-suite.
1 parent ee867ca commit 0908a65

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed
 

‎.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
poetry install
5454
poetry run pip uninstall -y faster-whisper
5555
poetry run pip install "faster-whisper @ https://github.com/SYSTRAN/faster-whisper/archive/d57c5b40b06e59ec44240d93485a95799548af50.tar.gz"
56-
poetry run pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
56+
poetry run pip install --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
5757
5858
- name: Install ffmpeg
5959
uses: FedericoCarboni/setup-ffmpeg@v2

‎tests/test_transcribe.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@ class TestTranscriber(unittest.TestCase):
2727
def setUp(self) -> None:
2828
self.audio_path = Path('data/test_audio.wav')
2929

30-
def test_transcribe_success(self):
31-
with patch('openlrc.transcribe.BatchedInferencePipeline') as MockModel:
32-
MockModel.return_value.transcribe.return_value = return_tuple
33-
34-
transcriber = Transcriber(model_name='tiny')
35-
result, info = transcriber.transcribe(self.audio_path)
36-
self.assertIsNotNone(result)
37-
self.assertEqual(round(info.duration), 30)
38-
39-
def test_audio_file_not_found(self):
40-
with patch('openlrc.transcribe.BatchedInferencePipeline') as MockModel:
41-
MockModel.return_value.transcribe.return_value = return_tuple
42-
43-
transcriber = Transcriber(model_name='tiny')
44-
with self.assertRaises(FileNotFoundError):
45-
transcriber.transcribe('audio.wav')
30+
@patch('openlrc.transcribe.BatchedInferencePipeline')
31+
@patch('openlrc.transcribe.WhisperModel')
32+
def test_transcribe_success(self, MockWhisperModel, MockBatchedInferencePipeline):
33+
MockBatchedInferencePipeline.return_value.transcribe.return_value = return_tuple
34+
35+
transcriber = Transcriber(model_name='tiny')
36+
result, info = transcriber.transcribe(self.audio_path)
37+
self.assertIsNotNone(result)
38+
self.assertEqual(round(info.duration), 30)
39+
40+
@patch('openlrc.transcribe.BatchedInferencePipeline')
41+
@patch('openlrc.transcribe.WhisperModel')
42+
def test_audio_file_not_found(self, MockWhisperModel, MockBatchedInferencePipeline):
43+
MockBatchedInferencePipeline.return_value.transcribe.return_value = return_tuple
44+
45+
transcriber = Transcriber(model_name='tiny')
46+
with self.assertRaises(FileNotFoundError):
47+
transcriber.transcribe('audio.wav')

0 commit comments

Comments
 (0)
Please sign in to comment.