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
e3f39a29
Unverified
Commit
e3f39a29
authored
Jun 29, 2021
by
Jabin Huang
Committed by
GitHub
Jun 29, 2021
Browse files
fix ids_to_tokens naming error in tokenizer of deberta v2 (#12412)
Co-authored-by:
Jipeng Huang
<
jihuan@microsoft.com
>
parent
81332868
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/models/deberta_v2/tokenization_deberta_v2.py
...transformers/models/deberta_v2/tokenization_deberta_v2.py
+2
-2
No files found.
src/transformers/models/deberta_v2/tokenization_deberta_v2.py
View file @
e3f39a29
...
...
@@ -288,7 +288,7 @@ class SPMTokenizer:
# <s> 1+1
# </s> 2+1
self
.
vocab
=
{
spm
.
IdToPiece
(
i
):
i
for
i
in
range
(
bpe_vocab_size
)}
self
.
id_to_tokens
=
[
spm
.
IdToPiece
(
i
)
for
i
in
range
(
bpe_vocab_size
)]
self
.
id
s
_to_tokens
=
[
spm
.
IdToPiece
(
i
)
for
i
in
range
(
bpe_vocab_size
)]
# self.vocab['[PAD]'] = 0
# self.vocab['[CLS]'] = 1
# self.vocab['[SEP]'] = 2
...
...
@@ -351,7 +351,7 @@ class SPMTokenizer:
self
.
special_tokens
.
append
(
token
)
if
token
not
in
self
.
vocab
:
self
.
vocab
[
token
]
=
len
(
self
.
vocab
)
-
1
self
.
id_to_tokens
.
append
(
token
)
self
.
id
s
_to_tokens
.
append
(
token
)
return
self
.
id
(
token
)
def
part_of_whole_word
(
self
,
token
,
is_bos
=
False
):
...
...
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