The Persimmon model was created by ADEPT, and authored by Erich Elsen, Augustus Odena, Maxwell Nye, Sağnak Taşırlar, Tri Dao, Curtis Hawthorne, Deepak Moparthi, Arushi Somani.
Persimmon
This model was contributed to Hugging Face Transformers on 2023-09-12.
Persimmon
Overview
The Persimmon model was created by ADEPT, and authored by Erich Elsen, Augustus Odena, Maxwell Nye, Sağnak Taşırlar, Tri Dao, Curtis Hawthorne, Deepak Moparthi, Arushi Somani.
The authors introduced Persimmon-8B, a decoder model based on the classic transformers architecture, with query and key normalization. Persimmon-8B is a fully permissively-licensed model with approximately 8 billion parameters, released under the Apache license. Some of the key attributes of Persimmon-8B are long context size (16K), performance, and capabilities for multimodal extensions.
The authors showcase their approach to model evaluation, focusing on practical text generation, mirroring how users interact with language models. The work also includes a comparative analysis, pitting Persimmon-8B against other prominent models (MPT 7B Instruct and Llama 2 Base 7B 1-Shot), across various evaluation tasks. The results demonstrate Persimmon-8B's competitive performance, even with limited training data.
In terms of model details, the work outlines the architecture and training methodology of Persimmon-8B, providing insights into its design choices, sequence length, and dataset composition. The authors present a fast inference code that outperforms traditional implementations through operator fusion and CUDA graph utilization while maintaining code coherence. They express their anticipation of how the community will leverage this contribution to drive innovation, hinting at further upcoming releases as part of an ongoing series of developments.
This model was contributed by ArthurZ. The original code can be found here.
Usage tips
The
Persimmonmodels were trained usingbfloat16, but the original inference usesfloat16The checkpoints uploaded on the hub usedtype = 'float16'which will be used by theAutoModelAPI to cast the checkpoints fromtorch.float32totorch.float16.The
dtypeof the online weights is mostly irrelevant, unless you are usingdtype="auto"when initializing a model usingmodel = AutoModelForCausalLM.from_pretrained("path", dtype = "auto"). The reason is that the model will first be downloaded ( using thedtypeof the checkpoints online) then it will be cast to the defaultdtypeoftorch(becomestorch.float32, device_map="auto"). Users should specify thedtypethey want, and if they don't it will betorch.float32.Finetuning the model in
float16is not recommended and known to producenan, as such the model should be fine-tuned inbfloat16.
Tips:
- To convert the model, you need to clone the original repository using
git clone, then get the checkpoints:
git clone https://github.com/persimmon-ai-labs/adept-inference
wget https://axtkn4xl5cip.objectstorage.us-phoenix-1.oci.customer-oci.com/n/axtkn4xl5cip/b/adept-public-data/o/8b_base_model_release.tar
tar -xvf 8b_base_model_release.tar
python src/transformers/models/persimmon/convert_persimmon_weights_to_hf.py --input_dir /path/to/downloaded/persimmon/weights/ --output_dir /output/path \
--pt_model_path /path/to/8b_chat_model_release/iter_0001251/mp_rank_00/model_optim_rng.pt
--ada_lib_path /path/to/adept-inference
For the chat model:
wget https://axtkn4xl5cip.objectstorage.us-phoenix-1.oci.customer-oci.com/n/axtkn4xl5cip/b/adept-public-data/o/8b_chat_model_release.tar
tar -xvf 8b_base_model_release.tar
Thereafter, models can be loaded via:
from transformers import PersimmonForCausalLM, PersimmonTokenizer
model = PersimmonForCausalLM.from_pretrained("/output/path", device_map="auto")
tokenizer = PersimmonTokenizer.from_pretrained("/output/path")
Perismmon uses a
sentencepiecebased tokenizer, with aUnigrammodel. It supports bytefallback, which is only available intokenizers==0.14.0for the fast tokenizer. TheLlamaTokenizeris used as it is a standard wrapper around sentencepiece. Thechattemplate will be updated with the templating functions in a follow up PR!The authors suggest to use the following prompt format for the chat mode:
f"human: {prompt}\n\nadept:"
PersimmonConfig
[[autodoc]] PersimmonConfig
PersimmonModel
[[autodoc]] PersimmonModel - forward
PersimmonForCausalLM
[[autodoc]] PersimmonForCausalLM - forward
PersimmonForSequenceClassification
[[autodoc]] PersimmonForSequenceClassification - forward
PersimmonForTokenClassification
[[autodoc]] PersimmonForTokenClassification - forward
Source and license
Source: Transformers documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.