From 4acdb5c619711eb9c0e1779e6fb1a6ff3d68d61b Mon Sep 17 00:00:00 2001 From: Natanael Tan Date: Fri, 17 May 2024 17:35:07 +0800 Subject: [PATCH] Fix #839 incorrect clip_timestamps being used in model (#842) * Fix #839 Changed the code from updating the TranscriptionOptions class instead of the options object which likely was the cause of unexpected behaviour --- faster_whisper/transcribe.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/faster_whisper/transcribe.py b/faster_whisper/transcribe.py index 3c8ab47..df4fec9 100644 --- a/faster_whisper/transcribe.py +++ b/faster_whisper/transcribe.py @@ -490,14 +490,16 @@ class WhisperModel: content_duration = float(content_frames * self.feature_extractor.time_per_frame) if isinstance(options.clip_timestamps, str): - TranscriptionOptions.clip_timestamps = [ - float(ts) - for ts in ( - options.clip_timestamps.split(",") - if options.clip_timestamps - else [] - ) - ] + options = options._replace( + clip_timestamps=[ + float(ts) + for ts in ( + options.clip_timestamps.split(",") + if options.clip_timestamps + else [] + ) + ] + ) seek_points: List[int] = [ round(ts * self.frames_per_second) for ts in options.clip_timestamps ]