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
c57e9d94
"...kernels/git@developer.sourcefind.cn:change/sglang.git" did not exist on "984730b732aa755706bdc269759e1da79862d19e"
Unverified
Commit
c57e9d94
authored
Jul 12, 2019
by
Thomas Wolf
Committed by
GitHub
Jul 12, 2019
Browse files
Merge branch 'xlnet' into embeddings
parents
2918b7d2
3821ecbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
pytorch_transformers/tokenization_gpt2.py
pytorch_transformers/tokenization_gpt2.py
+2
-2
No files found.
pytorch_transformers/tokenization_gpt2.py
View file @
c57e9d94
...
@@ -177,11 +177,11 @@ class GPT2Tokenizer(PreTrainedTokenizer):
...
@@ -177,11 +177,11 @@ class GPT2Tokenizer(PreTrainedTokenizer):
def
_convert_token_to_id
(
self
,
token
):
def
_convert_token_to_id
(
self
,
token
):
""" Converts a token (str/unicode) in an id using the vocab. """
""" Converts a token (str/unicode) in an id using the vocab. """
return
self
.
encoder
.
get
(
token
,
self
.
encoder
.
get
(
self
.
unk_token
)
)
return
self
.
encoder
.
get
(
token
)
def
_convert_id_to_token
(
self
,
index
):
def
_convert_id_to_token
(
self
,
index
):
"""Converts an index (integer) in a token (string/unicode) using the vocab."""
"""Converts an index (integer) in a token (string/unicode) using the vocab."""
return
self
.
decoder
.
get
(
index
,
self
.
unk_token
)
return
self
.
decoder
.
get
(
index
)
def
_convert_ids_to_string
(
self
,
tokens_ids
):
def
_convert_ids_to_string
(
self
,
tokens_ids
):
"""Converts a sequence of ids in a string."""
"""Converts a sequence of ids in a string."""
...
...
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