Merge remote-tracking branch 'upstream/main'
This commit is contained in:
+13
-5
@@ -408,16 +408,17 @@ class ServeClientTensorRT(ServeClientBase):
|
||||
json.dumps(
|
||||
{
|
||||
"uid": self.client_uid,
|
||||
"message": self.SERVER_READY
|
||||
"message": self.SERVER_READY,
|
||||
"backend": "tensorrt"
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
def warmup(self, warmup_steps=10):
|
||||
logging.info("[INFO:] Warming up TensorRT engine..")
|
||||
mel, duration = self.transcriber.log_mel_spectrogram("tests/jfk.flac")
|
||||
mel, _ = self.transcriber.log_mel_spectrogram("tests/jfk.flac")
|
||||
for i in range(warmup_steps):
|
||||
last_segment = self.transcriber.transcribe(mel)
|
||||
self.transcriber.transcribe(mel)
|
||||
|
||||
def set_eos(self, eos):
|
||||
self.lock.acquire()
|
||||
@@ -561,7 +562,7 @@ class ServeClientFasterWhisper(ServeClientBase):
|
||||
multilingual=False,
|
||||
language=None,
|
||||
client_uid=None,
|
||||
model="small",
|
||||
model="small.en",
|
||||
initial_prompt=None,
|
||||
vad_parameters=None,
|
||||
):
|
||||
@@ -595,6 +596,7 @@ class ServeClientFasterWhisper(ServeClientBase):
|
||||
self.task = task
|
||||
self.initial_prompt = initial_prompt
|
||||
self.vad_parameters = vad_parameters or {"threshold": 0.5}
|
||||
self.no_speech_thresh = 0.45
|
||||
|
||||
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||
|
||||
@@ -615,7 +617,8 @@ class ServeClientFasterWhisper(ServeClientBase):
|
||||
json.dumps(
|
||||
{
|
||||
"uid": self.client_uid,
|
||||
"message": self.SERVER_READY
|
||||
"message": self.SERVER_READY,
|
||||
"backend": "faster_whisper"
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -729,6 +732,7 @@ class ServeClientFasterWhisper(ServeClientBase):
|
||||
if time.time() - self.t_start > self.add_pause_thresh:
|
||||
self.text.append('')
|
||||
|
||||
if not len(segments): continue
|
||||
try:
|
||||
self.websocket.send(
|
||||
json.dumps({
|
||||
@@ -781,6 +785,10 @@ class ServeClientFasterWhisper(ServeClientBase):
|
||||
text_ = s.text
|
||||
self.text.append(text_)
|
||||
start, end = self.timestamp_offset + s.start, self.timestamp_offset + min(duration, s.end)
|
||||
|
||||
if start >= end: continue
|
||||
if s.no_speech_prob > self.no_speech_thresh: continue
|
||||
|
||||
self.transcript.append(self.format_segment(start, end, text_))
|
||||
|
||||
offset = min(duration, s.end)
|
||||
|
||||
Reference in New Issue
Block a user