Fix VAD index error when a predicted timestamps is too large (#107)
This commit is contained in:
@@ -208,7 +208,10 @@ class SpeechTimestampsMap:
|
|||||||
|
|
||||||
def get_chunk_index(self, time: float) -> int:
|
def get_chunk_index(self, time: float) -> int:
|
||||||
sample = int(time * self.sampling_rate)
|
sample = int(time * self.sampling_rate)
|
||||||
return bisect.bisect(self.chunk_end_sample, sample)
|
return min(
|
||||||
|
bisect.bisect(self.chunk_end_sample, sample),
|
||||||
|
len(self.chunk_end_sample) - 1,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@functools.lru_cache
|
@functools.lru_cache
|
||||||
|
|||||||
Reference in New Issue
Block a user