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
This commit is contained in:
Natanael Tan
2024-05-17 17:35:07 +08:00
committed by GitHub
parent a1c3583c96
commit 4acdb5c619

View File

@@ -490,14 +490,16 @@ class WhisperModel:
content_duration = float(content_frames * self.feature_extractor.time_per_frame) content_duration = float(content_frames * self.feature_extractor.time_per_frame)
if isinstance(options.clip_timestamps, str): if isinstance(options.clip_timestamps, str):
TranscriptionOptions.clip_timestamps = [ options = options._replace(
float(ts) clip_timestamps=[
for ts in ( float(ts)
options.clip_timestamps.split(",") for ts in (
if options.clip_timestamps options.clip_timestamps.split(",")
else [] if options.clip_timestamps
) else []
] )
]
)
seek_points: List[int] = [ seek_points: List[int] = [
round(ts * self.frames_per_second) for ts in options.clip_timestamps round(ts * self.frames_per_second) for ts in options.clip_timestamps
] ]