Override get_segment_end() in ServeClientOpenVINO to match OpenVINO's WhisperDecodedResultChunk class.
This commit is contained in:
@@ -99,6 +99,20 @@ class ServeClientOpenVINO(ServeClientBase):
|
|||||||
logging.info(f"Using OpenVINO device: {self.device}")
|
logging.info(f"Using OpenVINO device: {self.device}")
|
||||||
logging.info(f"Running OpenVINO backend with language: {self.language} and task: {self.task}")
|
logging.info(f"Running OpenVINO backend with language: {self.language} and task: {self.task}")
|
||||||
|
|
||||||
|
def get_segment_end(self, segment):
|
||||||
|
"""
|
||||||
|
Override base class implementation to handle OpenVINO's end timestamp sentinel value.
|
||||||
|
|
||||||
|
WhisperDecodedResultChunk.end_ts is -1.0 when the model did not predict an ending
|
||||||
|
timestamp (e.g. audio cut off mid-word). A negative end_ts causes a negative array
|
||||||
|
index in _identify_speaker(), producing an empty audio slice and silently disabling
|
||||||
|
diarization. Fall back to start_ts + 1.0 second in that case.
|
||||||
|
"""
|
||||||
|
end = getattr(segment, "end_ts", -1.0)
|
||||||
|
if end < 0:
|
||||||
|
return getattr(segment, "start_ts", 0) + 1.0
|
||||||
|
return end
|
||||||
|
|
||||||
def create_model(self, model_id):
|
def create_model(self, model_id):
|
||||||
"""
|
"""
|
||||||
Instantiates a new model, sets it as the transcriber.
|
Instantiates a new model, sets it as the transcriber.
|
||||||
|
|||||||
Reference in New Issue
Block a user