mirror of
https://github.com/shirayu/whispering.git
synced 2024-11-25 18:31:00 +00:00
Fix
This commit is contained in:
parent
f61f39c577
commit
b51d7c6cce
1 changed files with 7 additions and 3 deletions
|
@ -216,7 +216,9 @@ class WhisperStreamingTranscriber:
|
|||
seek: int = 0
|
||||
rest_start: Optional[int] = None
|
||||
while seek < mel.shape[-1]:
|
||||
logger.debug(f"seek={seek}, timestamp={self.timestamp}")
|
||||
logger.debug(
|
||||
f"seek={seek}, timestamp={self.timestamp}, rest_start={rest_start}"
|
||||
)
|
||||
segment = (
|
||||
pad_or_trim(mel[:, :, seek:], N_FRAMES)
|
||||
.to(self.model.device) # type: ignore
|
||||
|
@ -233,7 +235,9 @@ class WhisperStreamingTranscriber:
|
|||
self.config.logprob_threshold is not None
|
||||
and result.avg_logprob > self.config.logprob_threshold
|
||||
):
|
||||
return
|
||||
seek += segment.shape[-1]
|
||||
rest_start = None
|
||||
continue
|
||||
|
||||
segment_duration = segment.shape[-1] * HOP_LENGTH / SAMPLE_RATE
|
||||
last_timestamp_position: Optional[int] = None
|
||||
|
@ -251,9 +255,9 @@ class WhisperStreamingTranscriber:
|
|||
seek += last_timestamp_position
|
||||
rest_start = seek
|
||||
|
||||
logger.debug(f"Last rest_start={rest_start}")
|
||||
if rest_start is None:
|
||||
return
|
||||
|
||||
logger.debug(f"rest_start={rest_start}")
|
||||
self.buffer_mel = mel[:, :, rest_start:]
|
||||
del mel
|
||||
|
|
Loading…
Reference in a new issue