Downloads · 30 days
93
0% of all-time downloads
danielhanchen/open_llama_3b_600bt_preview
open_llama_3b_600bt_preview is a text generation model from danielhanchen. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Original model from https://huggingface.co/openlm-research/openllama3b600btpreview. Example below edited from https://github.com/openlm-research/openllama
Downloads · 30 days
93
0% of all-time downloads
All-time downloads
55.5K
Public
Parameters
3.4B
13.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin6.9 GB · 50%
How the weights are stored.
F163.4B · 100%
From the Hugging Face model README
Original model from https://huggingface.co/openlm-research/open_llama_3b_600bt_preview. Example below edited from https://github.com/openlm-research/open_llama
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "openlm-research/open_llama_3b_600bt_preview"
fast_model_name = "danielhanchen/open_llama_3b_600bt_preview"
tokenizer = AutoTokenizer.from_pretrained(fast_model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype = torch.float16, device_map = "auto")
prompt = "Q: What is the largest animal?\nA:"
input_ids = tokenizer(prompt, return_tensors = "pt").input_ids
print( tokenizer.decode( model.generate( input_ids, max_new_tokens = 32).ravel() ) )
This repo includes:
LlamaTokenizer to LlamaTokenizerFast via a few lines of code.
Loading via AutoTokenizer takes 4 to 5 minutes. Now, a few seconds!
Essentially the porting is done via the below code:# from huggingface_hub import notebook_login
# notebook_login()
from transformers import LlamaTokenizerFast
from tokenizers import AddedToken
tokenizer = LlamaTokenizerFast.from_pretrained(
"openlm-research/open_llama_3b_600bt_preview",
add_bos_token = True,
add_eos_token = False, # Original LLaMA is False -> add </s> during processing.
bos_token = AddedToken("<s>", single_word = True),
eos_token = AddedToken("</s>", single_word = True),
unk_token = AddedToken("<unk>", single_word = True),
pad_token = AddedToken("<unk>", single_word = True)
)
tokenizer.push_to_hub("open_llama_3b_600bt_preview")
AutoTokenizer does not recognize the BOS, EOS and UNK tokens. Weirdly <unk> ie the 0 token was added instead of the <s> or </s> token.<s>, EOS </s>, UNK <unk> tokens, with PAD (padding) being also the <unk> token.