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
901dde0e
Commit
901dde0e
authored
Aug 20, 2019
by
thomwolf
Browse files
fix #1014
parent
e239a4a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
pytorch_transformers/tokenization_bert.py
pytorch_transformers/tokenization_bert.py
+2
-0
No files found.
pytorch_transformers/tokenization_bert.py
View file @
901dde0e
...
@@ -187,6 +187,8 @@ class BertTokenizer(PreTrainedTokenizer):
...
@@ -187,6 +187,8 @@ class BertTokenizer(PreTrainedTokenizer):
index
=
0
index
=
0
if
os
.
path
.
isdir
(
vocab_path
):
if
os
.
path
.
isdir
(
vocab_path
):
vocab_file
=
os
.
path
.
join
(
vocab_path
,
VOCAB_FILES_NAMES
[
'vocab_file'
])
vocab_file
=
os
.
path
.
join
(
vocab_path
,
VOCAB_FILES_NAMES
[
'vocab_file'
])
else
:
vocab_file
=
vocab_path
with
open
(
vocab_file
,
"w"
,
encoding
=
"utf-8"
)
as
writer
:
with
open
(
vocab_file
,
"w"
,
encoding
=
"utf-8"
)
as
writer
:
for
token
,
token_index
in
sorted
(
self
.
vocab
.
items
(),
key
=
lambda
kv
:
kv
[
1
]):
for
token
,
token_index
in
sorted
(
self
.
vocab
.
items
(),
key
=
lambda
kv
:
kv
[
1
]):
if
index
!=
token_index
:
if
index
!=
token_index
:
...
...
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