1
0
mirror of https://github.com/osmarks/nanogpt-experiments.git synced 2024-12-18 06:00:29 +00:00

Merge pull request #199 from ChristianOrr/patch-1

bugfix in decode function
This commit is contained in:
Andrej 2023-03-12 13:40:20 -07:00 committed by GitHub
commit a82b33b525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ itos = { i:ch for i,ch in enumerate(chars) }
def encode(s): def encode(s):
return [stoi[c] for c in s] # encoder: take a string, output a list of integers return [stoi[c] for c in s] # encoder: take a string, output a list of integers
def decode(l): def decode(l):
''.join([itos[i] for i in l]) # decoder: take a list of integers, output a string return ''.join([itos[i] for i in l]) # decoder: take a list of integers, output a string
# create the train and test splits # create the train and test splits
n = len(data) n = len(data)