Skip to content

Commit d978fcc

Browse files
authored
Merge pull request #46 from PalabraAI/feature/benchmark-refactoring
New auto-tempo defaults and bugfix
2 parents 2331528 + 7e329e4 commit d978fcc

6 files changed

Lines changed: 21 additions & 8 deletions

File tree

‎src/palabra_ai/benchmark/__main__.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import bisect
55
import re
66
import wave
7-
from audioop import byteswap
87
from base64 import b64decode
98
from collections import defaultdict
109
from dataclasses import dataclass

‎src/palabra_ai/constant.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
SPEECH_TEMPO_ADJUSTMENT_FACTOR_DEFAULT = 0.75
7272

7373
# Queue Config Constants
74-
DESIRED_QUEUE_LEVEL_MS_DEFAULT = 10000
74+
DESIRED_QUEUE_LEVEL_MS_DEFAULT = 5000
7575
MAX_QUEUE_LEVEL_MS_DEFAULT = 24000
76-
QUEUE_MIN_TEMPO = 1.0
77-
QUEUE_MAX_TEMPO = 1.2
76+
QUEUE_MIN_TEMPO = 1.15
77+
QUEUE_MAX_TEMPO = 1.45
7878

7979
# TranscriptionMessage Constants
8080
MIN_ALIGNMENT_SCORE_DEFAULT = 0.2

‎src/palabra_ai/task/io/base.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class Io(Task):
5959
@property
6060
def io_data(self) -> IoData:
6161
return IoData(
62-
start_perf_ts=self.global_start_perf_ts,
63-
start_utc_ts=self.global_start_utc_ts,
62+
start_perf_ts=self.global_start_perf_ts or 0.0,
63+
start_utc_ts=self.global_start_utc_ts or 0.0,
6464
in_sr=self.cfg.mode.input_sample_rate,
6565
out_sr=self.cfg.mode.output_sample_rate,
6666
mode=self.cfg.mode.name,

‎tests/test_config.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def test_translation():
222222
def test_queue_configs():
223223
"""Test QueueConfigs with alias"""
224224
qc = QueueConfigs()
225-
assert qc.global_.desired_queue_level_ms == 10000
225+
assert qc.global_.desired_queue_level_ms == 5000
226226
assert qc.global_.max_queue_level_ms == 24000
227227
assert qc.global_.auto_tempo is True
228228

‎tests/test_constant.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_tts_constants():
7979

8080
def test_queue_config_constants():
8181
"""Test queue config constants"""
82-
assert constant.DESIRED_QUEUE_LEVEL_MS_DEFAULT == 10000
82+
assert constant.DESIRED_QUEUE_LEVEL_MS_DEFAULT == 5000
8383
assert constant.MAX_QUEUE_LEVEL_MS_DEFAULT == 24000
8484

8585

‎tests/test_task_adapter_buffer.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,20 @@ async def test_read_at_eof(self):
107107
mock_debug.assert_called_once()
108108
assert "EOF reached" in str(mock_debug.call_args[0][0])
109109

110+
@pytest.mark.asyncio
111+
async def test_empty_buffer_immediate_eof(self):
112+
"""Test that empty buffer immediately returns EOF without crashing"""
113+
empty_buffer = io.BytesIO(b"")
114+
reader = BufferReader(buffer=empty_buffer)
115+
reader.ready = TaskEvent()
116+
+reader.ready
117+
118+
# Reading from empty buffer should return None and set EOF
119+
data = await reader.read(100)
120+
assert data is None
121+
assert reader.eof.is_set()
122+
assert reader._position == 0
123+
110124

111125
class TestBufferWriter:
112126
"""Test BufferWriter class"""

0 commit comments

Comments
 (0)