byte_decoder -> byte_encoder
This commit is contained in:
parent
2ba85c8609
commit
cbdc56491d
2 changed files with 2 additions and 2 deletions
|
@ -154,7 +154,7 @@ for i in range(vocab_size):
|
||||||
text = bytearray()
|
text = bytearray()
|
||||||
for c in reverse_vocab[i]:
|
for c in reverse_vocab[i]:
|
||||||
if ord(c) < 256: # single byte character
|
if ord(c) < 256: # single byte character
|
||||||
text.append(byte_decoder[ord(c)])
|
text.append(byte_encoder[ord(c)])
|
||||||
else: # multibyte special token character
|
else: # multibyte special token character
|
||||||
text.extend(c.encode('utf-8'))
|
text.extend(c.encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -149,7 +149,7 @@ for i in range(vocab_size):
|
||||||
text = bytearray()
|
text = bytearray()
|
||||||
for c in reverse_vocab[i]:
|
for c in reverse_vocab[i]:
|
||||||
if ord(c) < 256: # single byte character
|
if ord(c) < 256: # single byte character
|
||||||
text.append(byte_decoder[ord(c)])
|
text.append(byte_encoder[ord(c)])
|
||||||
else: # multibyte special token character
|
else: # multibyte special token character
|
||||||
text.extend(c.encode('utf-8'))
|
text.extend(c.encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue