fix: server; remove debug stats

This commit is contained in:
makaveli10
2024-01-22 11:47:01 +00:00
parent 634dae835b
commit 3bf5b47947
+1 -12
View File
@@ -121,11 +121,6 @@ class TranscriptionServer:
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:
import tensorrt as trt import tensorrt as trt
@@ -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}")