tokenizer-arena / vocab /gpt_nexo_20b /test_hf_gpt_neox.py
xu-song's picture
update
751936e
raw
history blame
487 Bytes
"""
https://github.com/EleutherAI/gpt-neox/blob/main/tools/corpora.py
##
"""
from transformers import AutoTokenizer, AutoModelForCausalLM
# tokenizer = AutoTokenizer.from_pretrained("togethercomputer/GPT-NeoXT-Chat-Base-20B")
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
tokens = tokenizer.encode("good night\n中国 ss一个人去哪里")
print(tokens)
print(tokenizer.decode(tokens))
for token in tokens:
print(token, tokenizer.decode([token]))