Update decoding.py (#1219)

This commit is contained in:
Jong Wook Kim 2023-04-11 18:13:13 -04:00 committed by GitHub
parent b0022b3283
commit c09a7ae299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -469,9 +469,7 @@ class ApplyTimestampRules(LogitFilter):
]
if timestamps.numel() > 0:
# timestamps shouldn't decrease; forbid timestamp tokens smaller than the last
logits[k, self.tokenizer.timestamp_begin : timestamps[-1]] = -np.inf
# to force that timestamps are strictly increasing
# also force each segment to have a nonzero length, to prevent infinite looping
if last_was_timestamp and not penultimate_was_timestamp:
timestamp_last = timestamps[-1]
else: