mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 14:35:57 +00:00
Update decoding.py
This commit is contained in:
parent
b0022b3283
commit
f17b158af5
@ -469,9 +469,7 @@ class ApplyTimestampRules(LogitFilter):
|
|||||||
]
|
]
|
||||||
if timestamps.numel() > 0:
|
if timestamps.numel() > 0:
|
||||||
# timestamps shouldn't decrease; forbid timestamp tokens smaller than the last
|
# timestamps shouldn't decrease; forbid timestamp tokens smaller than the last
|
||||||
logits[k, self.tokenizer.timestamp_begin : timestamps[-1]] = -np.inf
|
# also force each segment to have a nonzero length, to prevent infinite looping
|
||||||
|
|
||||||
# to force that timestamps are strictly increasing
|
|
||||||
if last_was_timestamp and not penultimate_was_timestamp:
|
if last_was_timestamp and not penultimate_was_timestamp:
|
||||||
timestamp_last = timestamps[-1]
|
timestamp_last = timestamps[-1]
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user