import{s as Qt,o as Kt,n as Ie}from"../chunks/scheduler.9bc65507.js";import{S as eo,i as to,g as d,s as a,r as h,A as oo,h as l,f as o,c as r,j as G,u,x as m,k as U,y as c,a as s,v as f,d as g,t as _,w as b}from"../chunks/index.707bf1b6.js";import{T as it}from"../chunks/Tip.c2ecdbf4.js";import{D as be}from"../chunks/Docstring.17db21ae.js";import{C as Ze}from"../chunks/CodeBlock.54a9f38d.js";import{E as Et}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as ye}from"../chunks/Heading.342b1fa6.js";function no(C){let n,y=`The <code>Persimmon</code> models were trained using <code>bfloat16</code>, but the original inference uses <code>float16</code> The checkpoints uploaded on the hub use <code>torch_dtype = &#39;float16&#39;</code> which will be
used by the <code>AutoModel</code> API to cast the checkpoints from <code>torch.float32</code> to <code>torch.float16</code>.`,i,p,M="The <code>dtype</code> of the online weights is mostly irrelevant, unless you are using <code>torch_dtype=&quot;auto&quot;</code> when initializing a model using <code>model = AutoModelForCausalLM.from_pretrained(&quot;path&quot;, torch_dtype = &quot;auto&quot;)</code>. The reason is that the model will first be downloaded ( using the <code>dtype</code> of the checkpoints online) then it will be cast to the default <code>dtype</code> of <code>torch</code> (becomes <code>torch.float32</code>). Users should specify the <code>torch_dtype</code> they want, and if they don’t it will be <code>torch.float32</code>.",T,w,B="Finetuning the model in <code>float16</code> is not recommended and known to produce <code>nan</code>, as such the model should be fine-tuned in <code>bfloat16</code>.";return{c(){n=d("p"),n.innerHTML=y,i=a(),p=d("p"),p.innerHTML=M,T=a(),w=d("p"),w.innerHTML=B},l(v){n=l(v,"P",{"data-svelte-h":!0}),m(n)!=="svelte-17q3pz"&&(n.innerHTML=y),i=r(v),p=l(v,"P",{"data-svelte-h":!0}),m(p)!=="svelte-1mgue3n"&&(p.innerHTML=M),T=r(v),w=l(v,"P",{"data-svelte-h":!0}),m(w)!=="svelte-1p3drsu"&&(w.innerHTML=B)},m(v,S){s(v,n,S),s(v,i,S),s(v,p,S),s(v,T,S),s(v,w,S)},p:Ie,d(v){v&&(o(n),o(i),o(p),o(T),o(w))}}}function so(C){let n,y;return n=new Ze({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBlcnNpbW1vbk1vZGVsJTJDJTIwUGVyc2ltbW9uQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFBlcnNpbW1vbiUyMHBlcnNpbW1vbi03YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBQZXJzaW1tb25Db25maWcoKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PersimmonModel, PersimmonConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Persimmon persimmon-7b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = PersimmonConfig()`,wrap:!1}}),{c(){h(n.$$.fragment)},l(i){u(n.$$.fragment,i)},m(i,p){f(n,i,p),y=!0},p:Ie,i(i){y||(g(n.$$.fragment,i),y=!0)},o(i){_(n.$$.fragment,i),y=!1},d(i){b(n,i)}}}function ao(C){let n,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=y},l(i){n=l(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(i,p){s(i,n,p)},p:Ie,d(i){i&&o(n)}}}function ro(C){let n,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=y},l(i){n=l(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(i,p){s(i,n,p)},p:Ie,d(i){i&&o(n)}}}function io(C){let n,y="Example:",i,p,M;return p=new Ze({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBQZXJzaW1tb25Gb3JDYXVzYWxMTSUwQSUwQW1vZGVsJTIwJTNEJTIwUGVyc2ltbW9uRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmFkZXB0JTJGcGVyc2ltbW9uLThiLWJhc2UlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYWRlcHQlMkZwZXJzaW1tb24tOGItYmFzZSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJodW1hbiUzQSUyMEhleSUyQyUyMHdoYXQlMjBzaG91bGQlMjBJJTIwZWF0JTIwZm9yJTIwZGlubmVyJTNGJTIyJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMuaW5wdXRfaWRzJTJDJTIwbWF4X2xlbmd0aCUzRDMwKSUwQXRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, PersimmonForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = PersimmonForCausalLM.from_pretrained(<span class="hljs-string">&quot;adept/persimmon-8b-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;adept/persimmon-8b-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;human: Hey, what should I eat for dinner?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&#x27;human: Hey, what should I eat for dinner?\\n\\ncat: 🐱\\n\\nhuman: 😐\\n\\n&#x27;</span>`,wrap:!1}}),{c(){n=d("p"),n.textContent=y,i=a(),h(p.$$.fragment)},l(T){n=l(T,"P",{"data-svelte-h":!0}),m(n)!=="svelte-11lpom8"&&(n.textContent=y),i=r(T),u(p.$$.fragment,T)},m(T,w){s(T,n,w),s(T,i,w),f(p,T,w),M=!0},p:Ie,i(T){M||(g(p.$$.fragment,T),M=!0)},o(T){_(p.$$.fragment,T),M=!1},d(T){T&&(o(n),o(i)),b(p,T)}}}function lo(C){let n,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){n=d("p"),n.innerHTML=y},l(i){n=l(i,"P",{"data-svelte-h":!0}),m(n)!=="svelte-fincs2"&&(n.innerHTML=y)},m(i,p){s(i,n,p)},p:Ie,d(i){i&&o(n)}}}function co(C){let n,y,i,p,M,T,w,B,v,S='The Persimmon model was created by <a href="https://www.adept.ai/blog/persimmon-8b" rel="nofollow">ADEPT</a>, and authored by Erich Elsen, Augustus Odena, Maxwell Nye, Sağnak Taşırlar, Tri Dao, Curtis Hawthorne, Deepak Moparthi, Arushi Somani.',Ge,Y,zt="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.",Ue,O,Jt="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.",Se,A,Ft="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.",He,D,Lt=`This model was contributed by <a href="https://huggingface.co/ArthurZ" rel="nofollow">ArthurZ</a>.
The original code can be found <a href="https://github.com/persimmon-ai-labs/adept-inference" rel="nofollow">here</a>.`,je,E,Re,H,Xe,Q,Wt="Tips:",Ne,K,It="<li>To convert the model, you need to clone the original repository using <code>git clone https://github.com/persimmon-ai-labs/adept-inference</code>, then get the checkpoints:</li>",Ve,ee,Be,te,qt="For the chat model:",Ye,oe,Oe,ne,Zt="Thereafter, models can be loaded via:",Ae,se,De,ae,Gt=`<li><p>Perismmon uses a <code>sentencepiece</code> based tokenizer, with a <code>Unigram</code> model. It supports bytefallback, which is only available in <code>tokenizers==0.14.0</code> for the fast tokenizer.
The <code>LlamaTokenizer</code> is used as it is a standard wrapper around sentencepiece. The <code>chat</code> template will be updated with the templating functions in a follow up PR!</p></li> <li><p>The authors suggest to use the following prompt format for the chat mode: <code>f&quot;human: {prompt}\\n\\nadept:&quot;</code></p></li>`,Ee,re,Qe,x,ie,dt,Te,Ut=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonModel">PersimmonModel</a>. It is used to instantiate an
Persimmon model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the
<a href="https://huggingface.co/adept/persimmon-8b-base" rel="nofollow">adept/persimmon-8b-base</a>.`,lt,ve,St=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ct,j,Ke,de,et,P,le,mt,we,Ht=`The bare Persimmon Model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,pt,ke,jt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,ht,$e,Rt="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>PersimmonDecoderLayer</code>",ut,W,ce,ft,Me,Xt='The <a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonModel">PersimmonModel</a> forward method, overrides the <code>__call__</code> special method.',gt,R,tt,me,ot,q,pe,_t,J,he,bt,Pe,Nt='The <a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonForCausalLM">PersimmonForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',yt,X,Tt,N,nt,ue,st,k,fe,vt,Ce,Vt="The Persimmon transformer with a sequence classification head on top (linear layer).",wt,xe,Bt=`<a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonForSequenceClassification">PersimmonForSequenceClassification</a> uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`,kt,ze,Yt=`Since it does classification on the last token, it requires to know the position of the last token. If a
<code>pad_token_id</code> is defined in the configuration, it finds the last token that is not a padding token in each row. If
no <code>pad_token_id</code> is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when <code>inputs_embeds</code> are passed instead of <code>input_ids</code>, it does the same (take the last value in
each row of the batch).`,$t,Je,Ot=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Mt,Fe,At=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Pt,I,ge,Ct,Le,Dt='The <a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonForSequenceClassification">PersimmonForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',xt,V,at,qe,rt;return M=new ye({props:{title:"Persimmon",local:"persimmon",headingTag:"h1"}}),w=new ye({props:{title:"Overview",local:"overview",headingTag:"h2"}}),E=new ye({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),H=new it({props:{warning:!0,$$slots:{default:[no]},$$scope:{ctx:C}}}),ee=new Ze({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZwZXJzaW1tb24tYWktbGFicyUyRmFkZXB0LWluZmVyZW5jZSUwQXdnZXQlMjBodHRwcyUzQSUyRiUyRmF4dGtuNHhsNWNpcC5vYmplY3RzdG9yYWdlLnVzLXBob2VuaXgtMS5vY2kuY3VzdG9tZXItb2NpLmNvbSUyRm4lMkZheHRrbjR4bDVjaXAlMkZiJTJGYWRlcHQtcHVibGljLWRhdGElMkZvJTJGOGJfYmFzZV9tb2RlbF9yZWxlYXNlLnRhciUwQXRhciUyMC14dmYlMjA4Yl9iYXNlX21vZGVsX3JlbGVhc2UudGFyJTBBcHl0aG9uJTIwc3JjJTJGdHJhbnNmb3JtZXJzJTJGbW9kZWxzJTJGcGVyc2ltbW9uJTJGY29udmVydF9wZXJzaW1tb25fd2VpZ2h0c190b19oZi5weSUyMCUyMC0taW5wdXRfZGlyJTIwJTJGcGF0aCUyRnRvJTJGZG93bmxvYWRlZCUyRnBlcnNpbW1vbiUyRndlaWdodHMlMkYlMjAtLW91dHB1dF9kaXIlMjAlMkZvdXRwdXQlMkZwYXRoJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wdF9tb2RlbF9wYXRoJTIwJTJGcGF0aCUyRnRvJTJGOGJfY2hhdF9tb2RlbF9yZWxlYXNlJTJGaXRlcl8wMDAxMjUxJTJGbXBfcmFua18wMCUyRm1vZGVsX29wdGltX3JuZy5wdCUwQSUyMCUyMCUyMCUyMC0tYWRhX2xpYl9wYXRoJTIwJTJGcGF0aCUyRnRvJTJGYWRlcHQtaW5mZXJlbmNl",highlighted:`git <span class="hljs-built_in">clone</span> 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`,wrap:!1}}),oe=new Ze({props:{code:"d2dldCUyMGh0dHBzJTNBJTJGJTJGYXh0a240eGw1Y2lwLm9iamVjdHN0b3JhZ2UudXMtcGhvZW5peC0xLm9jaS5jdXN0b21lci1vY2kuY29tJTJGbiUyRmF4dGtuNHhsNWNpcCUyRmIlMkZhZGVwdC1wdWJsaWMtZGF0YSUyRm8lMkY4Yl9jaGF0X21vZGVsX3JlbGVhc2UudGFyJTBBdGFyJTIwLXh2ZiUyMDhiX2Jhc2VfbW9kZWxfcmVsZWFzZS50YXI=",highlighted:`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`,wrap:!1}}),se=new Ze({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBlcnNpbW1vbkZvckNhdXNhbExNJTJDJTIwUGVyc2ltbW9uVG9rZW5pemVyJTBBJTBBbW9kZWwlMjAlM0QlMjBQZXJzaW1tb25Gb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyJTJGb3V0cHV0JTJGcGF0aCUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBQZXJzaW1tb25Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMiUyRm91dHB1dCUyRnBhdGglMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PersimmonForCausalLM, PersimmonTokenizer

model = PersimmonForCausalLM.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)
tokenizer = PersimmonTokenizer.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)`,wrap:!1}}),re=new ye({props:{title:"PersimmonConfig",local:"transformers.PersimmonConfig",headingTag:"h2"}}),ie=new be({props:{name:"class transformers.PersimmonConfig",anchor:"transformers.PersimmonConfig",parameters:[{name:"vocab_size",val:" = 262144"},{name:"hidden_size",val:" = 4096"},{name:"intermediate_size",val:" = 16384"},{name:"num_hidden_layers",val:" = 36"},{name:"num_attention_heads",val:" = 64"},{name:"hidden_act",val:" = 'relu2'"},{name:"max_position_embeddings",val:" = 16384"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 25000.0"},{name:"rope_scaling",val:" = None"},{name:"qk_layernorm",val:" = True"},{name:"hidden_dropout",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"partial_rotary_factor",val:" = 0.5"},{name:"pad_token_id",val:" = None"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PersimmonConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 262144) &#x2014;
Vocabulary size of the Persimmon model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonModel">PersimmonModel</a>`,name:"vocab_size"},{anchor:"transformers.PersimmonConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.PersimmonConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16384) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.PersimmonConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 36) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.PersimmonConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.PersimmonConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;relu2&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder.`,name:"hidden_act"},{anchor:"transformers.PersimmonConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 16384) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.PersimmonConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.PersimmonConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the rms normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.PersimmonConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.PersimmonConfig.tie_word_embeddings(bool,",description:`<strong>tie_word_embeddings(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie weight embeddings`,name:"tie_word_embeddings(bool,"},{anchor:"transformers.PersimmonConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 25000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.PersimmonConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
<code>{&quot;type&quot;: strategy name, &quot;factor&quot;: scaling factor}</code>. When using this flag, don&#x2019;t update
<code>max_position_embeddings</code> to the expected new maximum. See the following thread for more information on how
these scaling strategies behave:
<a href="https://www.reddit.com/r/LocalPersimmon/comments/14mrgpr/dynamically_scaled_rope_further_increases/" rel="nofollow">https://www.reddit.com/r/LocalPersimmon/comments/14mrgpr/dynamically_scaled_rope_further_increases/</a>. This
is an experimental feature, subject to breaking API changes in future versions.`,name:"rope_scaling"},{anchor:"transformers.PersimmonConfig.qk_layernorm",description:`<strong>qk_layernorm</strong> (<code>bool</code>, <em>optional</em>, default to <code>True</code>) &#x2014;
Whether or not to normalize the Queries and Keys after projecting the hidden states`,name:"qk_layernorm"},{anchor:"transformers.PersimmonConfig.hidden_dropout",description:`<strong>hidden_dropout</strong> (<code>float</code>, <em>optional</em>, default to 0.0) &#x2014;
The dropout ratio after applying the MLP to the hidden states.`,name:"hidden_dropout"},{anchor:"transformers.PersimmonConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, default to 0.0) &#x2014;
The dropout ratio after computing the attention scores.`,name:"attention_dropout"},{anchor:"transformers.PersimmonConfig.partial_rotary_factor",description:`<strong>partial_rotary_factor</strong> (<code>float</code>, <em>optional</em>, default to 0.5) &#x2014;
Percentage of the query and keys which will have rotary embedding.</p>
<p>Example &#x2014;`,name:"partial_rotary_factor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/configuration_persimmon.py#L28"}}),j=new Et({props:{anchor:"transformers.PersimmonConfig.example",$$slots:{default:[so]},$$scope:{ctx:C}}}),de=new ye({props:{title:"PersimmonModel",local:"transformers.PersimmonModel",headingTag:"h2"}}),le=new be({props:{name:"class transformers.PersimmonModel",anchor:"transformers.PersimmonModel",parameters:[{name:"config",val:": PersimmonConfig"}],parametersDescription:[{anchor:"transformers.PersimmonModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonConfig">PersimmonConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.
config &#x2014; PersimmonConfig`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L548"}}),ce=new be({props:{name:"forward",anchor:"transformers.PersimmonModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PersimmonModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.PersimmonModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.PersimmonModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.PersimmonModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.PersimmonModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.PersimmonModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.PersimmonModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.PersimmonModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.PersimmonModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L577"}}),R=new it({props:{$$slots:{default:[ao]},$$scope:{ctx:C}}}),me=new ye({props:{title:"PersimmonForCausalLM",local:"transformers.PersimmonForCausalLM",headingTag:"h2"}}),pe=new be({props:{name:"class transformers.PersimmonForCausalLM",anchor:"transformers.PersimmonForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L701"}}),he=new be({props:{name:"forward",anchor:"transformers.PersimmonForCausalLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PersimmonForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.PersimmonForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.PersimmonForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.PersimmonForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.PersimmonForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.PersimmonForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.PersimmonForCausalLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.PersimmonForCausalLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.PersimmonForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.</p>
<p>Args &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L738",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonConfig"
>PersimmonConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>)</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),X=new it({props:{$$slots:{default:[ro]},$$scope:{ctx:C}}}),N=new Et({props:{anchor:"transformers.PersimmonForCausalLM.forward.example",$$slots:{default:[io]},$$scope:{ctx:C}}}),ue=new ye({props:{title:"PersimmonForSequenceClassification",local:"transformers.PersimmonForSequenceClassification",headingTag:"h2"}}),fe=new be({props:{name:"class transformers.PersimmonForSequenceClassification",anchor:"transformers.PersimmonForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.PersimmonForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/persimmon#transformers.PersimmonConfig">PersimmonConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L909"}}),ge=new be({props:{name:"forward",anchor:"transformers.PersimmonForSequenceClassification.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PersimmonForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.PersimmonForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.PersimmonForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.PersimmonForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.PersimmonForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.PersimmonForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.PersimmonForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.PersimmonForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.PersimmonForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.PersimmonForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/persimmon/modeling_persimmon.py#L925"}}),V=new it({props:{$$slots:{default:[lo]},$$scope:{ctx:C}}}),{c(){n=d("meta"),y=a(),i=d("p"),p=a(),h(M.$$.fragment),T=a(),h(w.$$.fragment),B=a(),v=d("p"),v.innerHTML=S,Ge=a(),Y=d("p"),Y.textContent=zt,Ue=a(),O=d("p"),O.textContent=Jt,Se=a(),A=d("p"),A.textContent=Ft,He=a(),D=d("p"),D.innerHTML=Lt,je=a(),h(E.$$.fragment),Re=a(),h(H.$$.fragment),Xe=a(),Q=d("p"),Q.textContent=Wt,Ne=a(),K=d("ul"),K.innerHTML=It,Ve=a(),h(ee.$$.fragment),Be=a(),te=d("p"),te.textContent=qt,Ye=a(),h(oe.$$.fragment),Oe=a(),ne=d("p"),ne.textContent=Zt,Ae=a(),h(se.$$.fragment),De=a(),ae=d("ul"),ae.innerHTML=Gt,Ee=a(),h(re.$$.fragment),Qe=a(),x=d("div"),h(ie.$$.fragment),dt=a(),Te=d("p"),Te.innerHTML=Ut,lt=a(),ve=d("p"),ve.innerHTML=St,ct=a(),h(j.$$.fragment),Ke=a(),h(de.$$.fragment),et=a(),P=d("div"),h(le.$$.fragment),mt=a(),we=d("p"),we.innerHTML=Ht,pt=a(),ke=d("p"),ke.innerHTML=jt,ht=a(),$e=d("p"),$e.innerHTML=Rt,ut=a(),W=d("div"),h(ce.$$.fragment),ft=a(),Me=d("p"),Me.innerHTML=Xt,gt=a(),h(R.$$.fragment),tt=a(),h(me.$$.fragment),ot=a(),q=d("div"),h(pe.$$.fragment),_t=a(),J=d("div"),h(he.$$.fragment),bt=a(),Pe=d("p"),Pe.innerHTML=Nt,yt=a(),h(X.$$.fragment),Tt=a(),h(N.$$.fragment),nt=a(),h(ue.$$.fragment),st=a(),k=d("div"),h(fe.$$.fragment),vt=a(),Ce=d("p"),Ce.textContent=Vt,wt=a(),xe=d("p"),xe.innerHTML=Bt,kt=a(),ze=d("p"),ze.innerHTML=Yt,$t=a(),Je=d("p"),Je.innerHTML=Ot,Mt=a(),Fe=d("p"),Fe.innerHTML=At,Pt=a(),I=d("div"),h(ge.$$.fragment),Ct=a(),Le=d("p"),Le.innerHTML=Dt,xt=a(),h(V.$$.fragment),at=a(),qe=d("p"),this.h()},l(e){const t=oo("svelte-u9bgzb",document.head);n=l(t,"META",{name:!0,content:!0}),t.forEach(o),y=r(e),i=l(e,"P",{}),G(i).forEach(o),p=r(e),u(M.$$.fragment,e),T=r(e),u(w.$$.fragment,e),B=r(e),v=l(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1dqqllh"&&(v.innerHTML=S),Ge=r(e),Y=l(e,"P",{"data-svelte-h":!0}),m(Y)!=="svelte-tohaaf"&&(Y.textContent=zt),Ue=r(e),O=l(e,"P",{"data-svelte-h":!0}),m(O)!=="svelte-gxqz2j"&&(O.textContent=Jt),Se=r(e),A=l(e,"P",{"data-svelte-h":!0}),m(A)!=="svelte-l2kkzt"&&(A.textContent=Ft),He=r(e),D=l(e,"P",{"data-svelte-h":!0}),m(D)!=="svelte-1kv44aj"&&(D.innerHTML=Lt),je=r(e),u(E.$$.fragment,e),Re=r(e),u(H.$$.fragment,e),Xe=r(e),Q=l(e,"P",{"data-svelte-h":!0}),m(Q)!=="svelte-axv494"&&(Q.textContent=Wt),Ne=r(e),K=l(e,"UL",{"data-svelte-h":!0}),m(K)!=="svelte-g9ue9k"&&(K.innerHTML=It),Ve=r(e),u(ee.$$.fragment,e),Be=r(e),te=l(e,"P",{"data-svelte-h":!0}),m(te)!=="svelte-1cs7acv"&&(te.textContent=qt),Ye=r(e),u(oe.$$.fragment,e),Oe=r(e),ne=l(e,"P",{"data-svelte-h":!0}),m(ne)!=="svelte-nia5es"&&(ne.textContent=Zt),Ae=r(e),u(se.$$.fragment,e),De=r(e),ae=l(e,"UL",{"data-svelte-h":!0}),m(ae)!=="svelte-yk84b4"&&(ae.innerHTML=Gt),Ee=r(e),u(re.$$.fragment,e),Qe=r(e),x=l(e,"DIV",{class:!0});var F=G(x);u(ie.$$.fragment,F),dt=r(F),Te=l(F,"P",{"data-svelte-h":!0}),m(Te)!=="svelte-63ur08"&&(Te.innerHTML=Ut),lt=r(F),ve=l(F,"P",{"data-svelte-h":!0}),m(ve)!=="svelte-o55m63"&&(ve.innerHTML=St),ct=r(F),u(j.$$.fragment,F),F.forEach(o),Ke=r(e),u(de.$$.fragment,e),et=r(e),P=l(e,"DIV",{class:!0});var z=G(P);u(le.$$.fragment,z),mt=r(z),we=l(z,"P",{"data-svelte-h":!0}),m(we)!=="svelte-2koooc"&&(we.innerHTML=Ht),pt=r(z),ke=l(z,"P",{"data-svelte-h":!0}),m(ke)!=="svelte-hswkmf"&&(ke.innerHTML=jt),ht=r(z),$e=l(z,"P",{"data-svelte-h":!0}),m($e)!=="svelte-3gfl0d"&&($e.innerHTML=Rt),ut=r(z),W=l(z,"DIV",{class:!0});var Z=G(W);u(ce.$$.fragment,Z),ft=r(Z),Me=l(Z,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-1wbx0c5"&&(Me.innerHTML=Xt),gt=r(Z),u(R.$$.fragment,Z),Z.forEach(o),z.forEach(o),tt=r(e),u(me.$$.fragment,e),ot=r(e),q=l(e,"DIV",{class:!0});var _e=G(q);u(pe.$$.fragment,_e),_t=r(_e),J=l(_e,"DIV",{class:!0});var L=G(J);u(he.$$.fragment,L),bt=r(L),Pe=l(L,"P",{"data-svelte-h":!0}),m(Pe)!=="svelte-n5vjih"&&(Pe.innerHTML=Nt),yt=r(L),u(X.$$.fragment,L),Tt=r(L),u(N.$$.fragment,L),L.forEach(o),_e.forEach(o),nt=r(e),u(ue.$$.fragment,e),st=r(e),k=l(e,"DIV",{class:!0});var $=G(k);u(fe.$$.fragment,$),vt=r($),Ce=l($,"P",{"data-svelte-h":!0}),m(Ce)!=="svelte-1oalnz1"&&(Ce.textContent=Vt),wt=r($),xe=l($,"P",{"data-svelte-h":!0}),m(xe)!=="svelte-1g4f24y"&&(xe.innerHTML=Bt),kt=r($),ze=l($,"P",{"data-svelte-h":!0}),m(ze)!=="svelte-10ugs3m"&&(ze.innerHTML=Yt),$t=r($),Je=l($,"P",{"data-svelte-h":!0}),m(Je)!=="svelte-6pahdo"&&(Je.innerHTML=Ot),Mt=r($),Fe=l($,"P",{"data-svelte-h":!0}),m(Fe)!=="svelte-hswkmf"&&(Fe.innerHTML=At),Pt=r($),I=l($,"DIV",{class:!0});var We=G(I);u(ge.$$.fragment,We),Ct=r(We),Le=l(We,"P",{"data-svelte-h":!0}),m(Le)!=="svelte-xuuqwj"&&(Le.innerHTML=Dt),xt=r(We),u(V.$$.fragment,We),We.forEach(o),$.forEach(o),at=r(e),qe=l(e,"P",{}),G(qe).forEach(o),this.h()},h(){U(n,"name","hf:doc:metadata"),U(n,"content",mo),U(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){c(document.head,n),s(e,y,t),s(e,i,t),s(e,p,t),f(M,e,t),s(e,T,t),f(w,e,t),s(e,B,t),s(e,v,t),s(e,Ge,t),s(e,Y,t),s(e,Ue,t),s(e,O,t),s(e,Se,t),s(e,A,t),s(e,He,t),s(e,D,t),s(e,je,t),f(E,e,t),s(e,Re,t),f(H,e,t),s(e,Xe,t),s(e,Q,t),s(e,Ne,t),s(e,K,t),s(e,Ve,t),f(ee,e,t),s(e,Be,t),s(e,te,t),s(e,Ye,t),f(oe,e,t),s(e,Oe,t),s(e,ne,t),s(e,Ae,t),f(se,e,t),s(e,De,t),s(e,ae,t),s(e,Ee,t),f(re,e,t),s(e,Qe,t),s(e,x,t),f(ie,x,null),c(x,dt),c(x,Te),c(x,lt),c(x,ve),c(x,ct),f(j,x,null),s(e,Ke,t),f(de,e,t),s(e,et,t),s(e,P,t),f(le,P,null),c(P,mt),c(P,we),c(P,pt),c(P,ke),c(P,ht),c(P,$e),c(P,ut),c(P,W),f(ce,W,null),c(W,ft),c(W,Me),c(W,gt),f(R,W,null),s(e,tt,t),f(me,e,t),s(e,ot,t),s(e,q,t),f(pe,q,null),c(q,_t),c(q,J),f(he,J,null),c(J,bt),c(J,Pe),c(J,yt),f(X,J,null),c(J,Tt),f(N,J,null),s(e,nt,t),f(ue,e,t),s(e,st,t),s(e,k,t),f(fe,k,null),c(k,vt),c(k,Ce),c(k,wt),c(k,xe),c(k,kt),c(k,ze),c(k,$t),c(k,Je),c(k,Mt),c(k,Fe),c(k,Pt),c(k,I),f(ge,I,null),c(I,Ct),c(I,Le),c(I,xt),f(V,I,null),s(e,at,t),s(e,qe,t),rt=!0},p(e,[t]){const F={};t&2&&(F.$$scope={dirty:t,ctx:e}),H.$set(F);const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),j.$set(z);const Z={};t&2&&(Z.$$scope={dirty:t,ctx:e}),R.$set(Z);const _e={};t&2&&(_e.$$scope={dirty:t,ctx:e}),X.$set(_e);const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),N.$set(L);const $={};t&2&&($.$$scope={dirty:t,ctx:e}),V.$set($)},i(e){rt||(g(M.$$.fragment,e),g(w.$$.fragment,e),g(E.$$.fragment,e),g(H.$$.fragment,e),g(ee.$$.fragment,e),g(oe.$$.fragment,e),g(se.$$.fragment,e),g(re.$$.fragment,e),g(ie.$$.fragment,e),g(j.$$.fragment,e),g(de.$$.fragment,e),g(le.$$.fragment,e),g(ce.$$.fragment,e),g(R.$$.fragment,e),g(me.$$.fragment,e),g(pe.$$.fragment,e),g(he.$$.fragment,e),g(X.$$.fragment,e),g(N.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(ge.$$.fragment,e),g(V.$$.fragment,e),rt=!0)},o(e){_(M.$$.fragment,e),_(w.$$.fragment,e),_(E.$$.fragment,e),_(H.$$.fragment,e),_(ee.$$.fragment,e),_(oe.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(j.$$.fragment,e),_(de.$$.fragment,e),_(le.$$.fragment,e),_(ce.$$.fragment,e),_(R.$$.fragment,e),_(me.$$.fragment,e),_(pe.$$.fragment,e),_(he.$$.fragment,e),_(X.$$.fragment,e),_(N.$$.fragment,e),_(ue.$$.fragment,e),_(fe.$$.fragment,e),_(ge.$$.fragment,e),_(V.$$.fragment,e),rt=!1},d(e){e&&(o(y),o(i),o(p),o(T),o(B),o(v),o(Ge),o(Y),o(Ue),o(O),o(Se),o(A),o(He),o(D),o(je),o(Re),o(Xe),o(Q),o(Ne),o(K),o(Ve),o(Be),o(te),o(Ye),o(Oe),o(ne),o(Ae),o(De),o(ae),o(Ee),o(Qe),o(x),o(Ke),o(et),o(P),o(tt),o(ot),o(q),o(nt),o(st),o(k),o(at),o(qe)),o(n),b(M,e),b(w,e),b(E,e),b(H,e),b(ee,e),b(oe,e),b(se,e),b(re,e),b(ie),b(j),b(de,e),b(le),b(ce),b(R),b(me,e),b(pe),b(he),b(X),b(N),b(ue,e),b(fe),b(ge),b(V)}}}const mo='{"title":"Persimmon","local":"persimmon","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"PersimmonConfig","local":"transformers.PersimmonConfig","sections":[],"depth":2},{"title":"PersimmonModel","local":"transformers.PersimmonModel","sections":[],"depth":2},{"title":"PersimmonForCausalLM","local":"transformers.PersimmonForCausalLM","sections":[],"depth":2},{"title":"PersimmonForSequenceClassification","local":"transformers.PersimmonForSequenceClassification","sections":[],"depth":2}],"depth":1}';function po(C){return Kt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class To extends eo{constructor(n){super(),to(this,n,po,co,Qt,{})}}export{To as component};
