"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "6b735a7253a4fca1af78b4f0a7b60b738b7cd8c2"
Commit 901dde0e authored by thomwolf's avatar thomwolf
Browse files

fix #1014

parent e239a4a2
...@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment