candidate changes to apis, have to think through more

This commit is contained in:
Andrej Karpathy committed 2023-01-01 01:29:48 +00:00
1 parent 7c6ea8409e
commit 2febf4463c
8 files changed
+111 -19

No files matched your search

+1
View File
@@ -35,6 +35,7 @@ enc = tiktoken.get_encoding("gpt2")
def process(example):
ids = enc.encode_ordinary(example['text']) # encode_ordinary ignores any special tokens
ids.append(enc.eot_token) # add the end of text token, e.g. 50256 for gpt2 bpe
# note: I think eot should be prepended not appended... hmm. it's called "eot" though...
out = {'ids': ids, 'len': len(ids)}
return out