fix: server; remove debug stats
This commit is contained in:
+1
-12
@@ -120,11 +120,6 @@ class TranscriptionServer:
|
|||||||
websocket.close()
|
websocket.close()
|
||||||
del websocket
|
del websocket
|
||||||
return
|
return
|
||||||
|
|
||||||
# validate custom model
|
|
||||||
if custom_model_path is not None and os.path.exists(custom_model_path):
|
|
||||||
logging.info(f"Using custom model {custom_model_path}")
|
|
||||||
options["model"] = custom_model_path
|
|
||||||
|
|
||||||
if self.backend == "tensorrt":
|
if self.backend == "tensorrt":
|
||||||
try:
|
try:
|
||||||
@@ -487,7 +482,7 @@ class ServeClientTensorRT(ServeClientBase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
input_sample = input_bytes.copy()
|
input_sample = input_bytes.copy()
|
||||||
|
logging.info(f"[WhisperTensorRT:] Processing audio with duration: {duration}")
|
||||||
mel, duration = self.transcriber.log_mel_spectrogram(input_sample)
|
mel, duration = self.transcriber.log_mel_spectrogram(input_sample)
|
||||||
last_segment = self.transcriber.transcribe(mel)
|
last_segment = self.transcriber.transcribe(mel)
|
||||||
segments = []
|
segments = []
|
||||||
@@ -496,7 +491,6 @@ class ServeClientTensorRT(ServeClientBase):
|
|||||||
segments = self.transcript[:].copy()
|
segments = self.transcript[:].copy()
|
||||||
else:
|
else:
|
||||||
segments = self.transcript[-self.send_last_n_segments:].copy()
|
segments = self.transcript[-self.send_last_n_segments:].copy()
|
||||||
print(self.transcript, len(self.transcript))
|
|
||||||
if last_segment is not None:
|
if last_segment is not None:
|
||||||
segments.append({"text": last_segment})
|
segments.append({"text": last_segment})
|
||||||
try:
|
try:
|
||||||
@@ -508,17 +502,12 @@ class ServeClientTensorRT(ServeClientBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if self.eos:
|
if self.eos:
|
||||||
print("EOS is true: ", self.timestamp_offset, duration)
|
|
||||||
if not len(self.transcript):
|
if not len(self.transcript):
|
||||||
self.transcript.append({"text": last_segment + " "})
|
self.transcript.append({"text": last_segment + " "})
|
||||||
elif self.transcript[-1]["text"].strip() != last_segment:
|
elif self.transcript[-1]["text"].strip() != last_segment:
|
||||||
self.transcript.append({"text": last_segment + " "})
|
self.transcript.append({"text": last_segment + " "})
|
||||||
self.timestamp_offset += duration
|
self.timestamp_offset += duration
|
||||||
# self.set_eos(False)
|
|
||||||
|
|
||||||
# logging.info(
|
|
||||||
# f"[INFO:] Processed : {self.timestamp_offset} seconds / {self.frames_np.shape[0] / self.RATE} seconds"
|
|
||||||
# )
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"[ERROR]: {e}")
|
logging.error(f"[ERROR]: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user