Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/tokenizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3610,6 +3610,7 @@ export class WhisperTokenizer extends PreTrainedTokenizer {
let chunk = new_chunk();
let time_offset = 0.0;
const timestamp_begin = this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0] + 1;
const timestamp_end = this.model.convert_tokens_to_ids(["<|30.00|>"])[0];

let previous_tokens = [];
let previous_token_timestamps = [];
Expand Down Expand Up @@ -3697,7 +3698,7 @@ export class WhisperTokenizer extends PreTrainedTokenizer {
} else {
// 2/ This is a regular special token, ignoring it
}
} else if (token >= timestamp_begin) {
} else if (token >= timestamp_begin && token <= timestamp_end) {
// 3/ Timestamp token
const time = (token - timestamp_begin) * time_precision + time_offset;
const rounded_time = round(time, 2);
Expand Down