Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
Fix bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberZHG committed May 29, 2019
1 parent ddfcad7 commit 4f019d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion keras_gpt_2/bpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def get_bpe(self, token):
def encode(self, text):
indices = []
for token in re.findall(self.token_pattern, text):
chars = ''.join(self.byte_encoder[code] for code in token.encode('utf-8'))
token = bytearray(token.encode('utf-8'))
chars = ''.join(self.byte_encoder[code] for code in token)
indices += [self.token_dict[token] for token in self.get_bpe(chars)]
return indices

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='keras-gpt-2',
version='0.9.0',
version='0.10.0',
packages=find_packages(),
url='https://github.com/CyberZHG/keras-gpt-2',
license='MIT',
Expand Down

0 comments on commit 4f019d2

Please sign in to comment.