From b1019d2a8e5725f4f72fc8abb4085fef8a60c7e4 Mon Sep 17 00:00:00 2001 From: Yiqing-Zhou <40547184+Yiqing-Zhou@users.noreply.github.com> Date: Tue, 23 Jul 2019 20:41:26 +0800 Subject: [PATCH] token[-1] -> token.rstrip('\n') --- pytorch_transformers/tokenization_bert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_transformers/tokenization_bert.py b/pytorch_transformers/tokenization_bert.py index acf89b6984..f9c97b7d12 100644 --- a/pytorch_transformers/tokenization_bert.py +++ b/pytorch_transformers/tokenization_bert.py @@ -69,7 +69,7 @@ def load_vocab(vocab_file): with open(vocab_file, "r", encoding="utf-8") as reader: tokens = reader.readlines() for index, token in enumerate(tokens): - token = token[:-1] + token = token.rstrip('\n') vocab[token] = index return vocab