Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
d8415ba4
Unverified
Commit
d8415ba4
authored
Jan 23, 2023
by
Arthur
Committed by
GitHub
Jan 23, 2023
Browse files
[Whisper] fix all issues with unk token (#21250)
* fix all issues with unk token * fixup
parent
c18b4fbe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
src/transformers/models/whisper/tokenization_whisper.py
src/transformers/models/whisper/tokenization_whisper.py
+5
-2
No files found.
src/transformers/models/whisper/tokenization_whisper.py
View file @
d8415ba4
...
...
@@ -479,8 +479,11 @@ class WhisperTokenizer(PreTrainedTokenizer):
return
self
.
encoder
.
get
(
token
,
self
.
encoder
.
get
(
self
.
unk_token
))
def
_convert_id_to_token
(
self
,
index
):
"""Converts an index (integer) in a token (str) using the vocab."""
return
self
.
decoder
.
get
(
index
,
self
.
decoder
.
get
(
self
.
unk_token_id
))
"""
Converts an index (integer) in a token (str) using the vocab. Whisper's base tokenizer always decodes OOV
tokens as "", thus we do not use the `unk_token` here.
"""
return
self
.
decoder
.
get
(
index
,
""
)
def
_normalize
(
self
,
text
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment