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
f6d5046a
Unverified
Commit
f6d5046a
authored
Jun 02, 2020
by
Funtowicz Morgan
Committed by
GitHub
Jun 02, 2020
Browse files
Override get_vocab for fast tokenizer. (#4717)
parent
88762a2f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
src/transformers/tokenization_utils.py
src/transformers/tokenization_utils.py
+3
-0
No files found.
src/transformers/tokenization_utils.py
View file @
f6d5046a
...
...
@@ -2368,6 +2368,9 @@ class PreTrainedTokenizerFast(PreTrainedTokenizer):
def
_convert_id_to_token
(
self
,
index
:
int
)
->
Optional
[
str
]:
return
self
.
_tokenizer
.
id_to_token
(
int
(
index
))
def
get_vocab
(
self
):
return
self
.
_tokenizer
.
get_vocab
(
True
)
def
convert_tokens_to_string
(
self
,
tokens
:
List
[
int
],
skip_special_tokens
:
bool
=
False
)
->
str
:
return
self
.
_tokenizer
.
decode
(
tokens
,
skip_special_tokens
)
...
...
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