Ignore linting as this file is a copy from faster_whisper
Signed-off-by: makaveli10 <suryanvineet47@gmail.com>
This commit is contained in:
@@ -423,7 +423,7 @@ class WhisperModel:
|
||||
|
||||
return segments, info
|
||||
|
||||
def generate_segments(
|
||||
def generate_segments( # noqa: C901
|
||||
self,
|
||||
features: np.ndarray,
|
||||
tokenizer: Tokenizer,
|
||||
@@ -496,7 +496,7 @@ class WhisperModel:
|
||||
content_frames - seek,
|
||||
seek_clip_end - seek,
|
||||
)
|
||||
segment = features[:, seek : seek + segment_size]
|
||||
segment = features[:, seek : seek + segment_size] # noqa: E203
|
||||
segment_duration = segment_size * self.feature_extractor.time_per_frame
|
||||
segment = pad_or_trim(segment, self.feature_extractor.nb_max_frames)
|
||||
|
||||
@@ -685,7 +685,7 @@ class WhisperModel:
|
||||
continue
|
||||
if is_segment_anomaly(segment):
|
||||
next_segment = next_words_segment(
|
||||
current_segments[si + 1 :]
|
||||
current_segments[si + 1 :] # noqa: E203
|
||||
)
|
||||
if next_segment is not None:
|
||||
hal_next_start = next_segment["words"][0]["start"]
|
||||
@@ -909,7 +909,7 @@ class WhisperModel:
|
||||
|
||||
if previous_tokens:
|
||||
prompt.append(tokenizer.sot_prev)
|
||||
prompt.extend(previous_tokens[-(self.max_length // 2 - 1) :])
|
||||
prompt.extend(previous_tokens[-(self.max_length // 2 - 1) :]) # noqa: E203
|
||||
|
||||
prompt.extend(tokenizer.sot_sequence)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user