Merge pull request #893 from joelgrus/patch-2

make save_pretrained do the right thing with added tokens
This commit is contained in:
Thomas Wolf 2019-07-25 14:58:48 +02:00 committed by GitHub
commit c244562cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,7 +266,7 @@ class PreTrainedTokenizer(object):
with open(added_tokens_file, 'w', encoding='utf-8') as f:
if self.added_tokens_encoder:
out_str = json.dumps(self.added_tokens_decoder, ensure_ascii=False)
out_str = json.dumps(self.added_tokens_encoder, ensure_ascii=False)
else:
out_str = u"{}"
f.write(out_str)