simulstreaming: fixes token handling during warm-up phase

This commit is contained in:
Quentin Fuxa
2025-07-31 16:25:34 +02:00
parent f85329e112
commit 8a5e2adb1e
3 changed files with 5 additions and 6 deletions

View File

@@ -261,9 +261,10 @@ class PaddedAlignAttWhisper:
segments_len -= removed_len
self.last_attend_frame -= int(TOKENS_PER_SECOND*removed_len)
self.segments = self.segments[1:]
logger.debug(f"remove segments: {len(self.segments)} {len(self.tokens)}")
self.context.append_token_ids(self.tokens[1][0,:])
self.tokens = [self.initial_tokens] + self.tokens[2:]
if len(self.tokens) > 1: # When warming up, we can have a too long segments_len while not having any tokens yet
self.context.append_token_ids(self.tokens[1][0,:])
self.context.append_token_ids(self.tokens[1][0,:])
self.tokens = [self.initial_tokens] + self.tokens[2:]
return removed_len

View File

@@ -481,7 +481,6 @@ class SimulStreamingASR(ASRBase):
try:
if isinstance(audio, np.ndarray):
audio = torch.from_numpy(audio).float()
print(audio)
self.model.insert_audio(audio)
self.model.infer(True)
self.model.refresh_segment(complete=True)

View File

@@ -680,8 +680,7 @@ class SimulStreamingOnlineProcessor:
except Exception as e:
logger.error(f"SimulStreaming processing error: {e}")
logger.error(f"Error details: {type(e).__name__}: {str(e)}")
logger.exception(f"SimulStreaming processing error: {e}")
return [], self.end
def finish(self) -> Tuple[List[ASRToken], float]: