import{s as Mo,o as $o,n as Ve}from"../chunks/scheduler.25b97de1.js";import{S as Lo,i as xo,g as l,s as n,r as h,A as So,h as d,f as o,c as a,j as q,u,x as p,k as J,y as i,a as r,v as f,d as g,t as _,w as b}from"../chunks/index.d9030fc9.js";import{T as kt}from"../chunks/Tip.baa67368.js";import{D as G}from"../chunks/Docstring.ffac8efa.js";import{C as Ee}from"../chunks/CodeBlock.e6cd0d95.js";import{E as wo}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as U,E as Co}from"../chunks/EditOnGithub.91d95064.js";function zo(x){let s,T="Example:",c,y,k;return y=new Ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFN0YWJsZUxtTW9kZWwlMkMlMjBTdGFibGVMbUNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBTdGFibGVMTSUyMHN0YWJsZWxtLTNiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFN0YWJsZUxtQ29uZmlnKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> StableLmModel, StableLmConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a StableLM stablelm-3b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = StableLmConfig()`,wrap:!1}}),{c(){s=l("p"),s.textContent=T,c=n(),h(y.$$.fragment)},l(m){s=d(m,"P",{"data-svelte-h":!0}),p(s)!=="svelte-11lpom8"&&(s.textContent=T),c=a(m),u(y.$$.fragment,m)},m(m,M){r(m,s,M),r(m,c,M),f(y,m,M),k=!0},p:Ve,i(m){k||(g(y.$$.fragment,m),k=!0)},o(m){_(y.$$.fragment,m),k=!1},d(m){m&&(o(s),o(c)),b(y,m)}}}function Fo(x){let s,T=`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(){s=l("p"),s.innerHTML=T},l(c){s=d(c,"P",{"data-svelte-h":!0}),p(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(c,y){r(c,s,y)},p:Ve,d(c){c&&o(s)}}}function Io(x){let s,T=`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(){s=l("p"),s.innerHTML=T},l(c){s=d(c,"P",{"data-svelte-h":!0}),p(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(c,y){r(c,s,y)},p:Ve,d(c){c&&o(s)}}}function qo(x){let s,T="Example:",c,y,k;return y=new Ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBTdGFibGVMbUZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBTdGFibGVMbUZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJzdGFiaWxpdHlhaSUyRnN0YWJsZWxtLTNiLTRlMXQlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGVsbS0zYi00ZTF0JTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMlRoZSUyMHdlYXRoZXIlMjBpcyUyMGFsd2F5cyUyMHdvbmRlcmZ1bCUyMGluJTIyJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMEFnZW5lcmF0ZV9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMuaW5wdXRfaWRzJTJDJTIwbWF4X2xlbmd0aCUzRDMwKSUwQXRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUlMkMlMjBjbGVhbl91cF90b2tlbml6YXRpb25fc3BhY2VzJTNERmFsc2UpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, StableLmForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = StableLmForCausalLM.from_pretrained(<span class="hljs-string">&quot;stabilityai/stablelm-3b-4e1t&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stabilityai/stablelm-3b-4e1t&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;The weather is always wonderful in&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;The weather is always wonderful in the summer in the city of San Diego. The city is located on the coast of the Pacific Ocean and is surrounded by&#x27;</span>`,wrap:!1}}),{c(){s=l("p"),s.textContent=T,c=n(),h(y.$$.fragment)},l(m){s=d(m,"P",{"data-svelte-h":!0}),p(s)!=="svelte-11lpom8"&&(s.textContent=T),c=a(m),u(y.$$.fragment,m)},m(m,M){r(m,s,M),r(m,c,M),f(y,m,M),k=!0},p:Ve,i(m){k||(g(y.$$.fragment,m),k=!0)},o(m){_(y.$$.fragment,m),k=!1},d(m){m&&(o(s),o(c)),b(y,m)}}}function Jo(x){let s,T=`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(){s=l("p"),s.innerHTML=T},l(c){s=d(c,"P",{"data-svelte-h":!0}),p(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(c,y){r(c,s,y)},p:Ve,d(c){c&&o(s)}}}function Wo(x){let s,T=`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(){s=l("p"),s.innerHTML=T},l(c){s=d(c,"P",{"data-svelte-h":!0}),p(s)!=="svelte-fincs2"&&(s.innerHTML=T)},m(c,y){r(c,s,y)},p:Ve,d(c){c&&o(s)}}}function jo(x){let s,T,c,y,k,m,M,Oe,A,Qt='<code>StableLM 3B 4E1T</code> was proposed in <a href="https://stability.wandb.io/stability-llm/stable-lm/reports/StableLM-3B-4E1T--VmlldzoyMjU4?accessToken=u3zujipenkx5g7rtcj9qojjgxpconyjktjkli2po09nffrffdhhchq045vp0wyfo" rel="nofollow"><code>StableLM 3B 4E1T</code>: Technical Report</a> by Stability AI and is the first model in a series of multi-epoch pre-trained language models.',Ae,Q,Qe,D,Dt=`<code>StableLM 3B 4E1T</code> is a decoder-only base language model pre-trained on 1 trillion tokens of diverse English and code datasets for four epochs.
The model architecture is transformer-based with partial Rotary Position Embeddings, SwiGLU activation, LayerNorm, etc.`,De,Y,Yt="We also provide <code>StableLM Zephyr 3B</code>, an instruction fine-tuned version of the model that can be used for chat-based applications.",Ye,K,Ke,ee,Kt='<li>The architecture is similar to LLaMA but with RoPE applied to 25% of head embedding dimensions, LayerNorm instead of RMSNorm, and optional QKV bias terms.</li> <li><code>StableLM 3B 4E1T</code>-based models uses the same tokenizer as <a href="/docs/transformers/pr_30950/en/model_doc/gpt_neox#transformers.GPTNeoXTokenizerFast">GPTNeoXTokenizerFast</a>.</li>',et,te,eo='<code>StableLM 3B 4E1T</code> and <code>StableLM Zephyr 3B</code> can be found on the <a href="https://huggingface.co/stabilityai" rel="nofollow">Huggingface Hub</a>',tt,oe,to="The following code snippet demonstrates how to use <code>StableLM 3B 4E1T</code> for inference:",ot,ne,nt,ae,at,se,oo="First, make sure to install the latest version of Flash Attention v2.",st,re,rt,ie,no='Also make sure that your hardware is compatible with Flash-Attention 2. Read more about it in the official documentation of the <a href="https://github.com/Dao-AILab/flash-attention" rel="nofollow"><code>flash-attn</code></a> repository. Note: you must load your model in half-precision (e.g. <code>torch.bfloat16</code>).',it,le,ao="Now, to run the model with Flash Attention 2, refer to the snippet below:",lt,de,dt,ce,ct,S,me,wt,Le,so=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmModel">~StableLmModel</a>.
It is used to instantiate an StableLM 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 StableLM <a href="https://huggingface.co/stabilityai/stablelm-3b-4e1t" rel="nofollow">stabilityai/stablelm-3b-4e1t</a> architecture.`,Mt,xe,ro=`Configuration objects inherit from  <a href="/docs/transformers/pr_30950/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/pr_30950/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>
for more information.`,$t,B,mt,pe,pt,$,he,Lt,Se,io=`The bare StableLm Model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/pr_30950/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.)`,xt,Ce,lo=`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.`,St,ze,co="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>StableLmDecoderLayer</code>",Ct,W,ue,zt,Fe,mo='The <a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmModel">StableLmModel</a> forward method, overrides the <code>__call__</code> special method.',Ft,H,ht,fe,ut,R,ge,It,z,_e,qt,Ie,po='The <a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmForCausalLM">StableLmForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',Jt,V,Wt,X,ft,be,gt,v,ye,jt,qe,ho="The StableLm transformer with a sequence classification head on top (linear layer).",Zt,Je,uo=`<a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmForSequenceClassification">StableLmForSequenceClassification</a> uses the last token in order to do the classification, as other causal
models (e.g. GPT-2) do.`,Pt,We,fo=`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).`,Ut,je,go=`This model inherits from <a href="/docs/transformers/pr_30950/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.)`,Rt,Ze,_o=`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.`,Nt,j,Te,Gt,Pe,bo='The <a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmForSequenceClassification">StableLmForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Bt,E,_t,ve,bt,L,ke,Ht,Ue,yo=`The StableLm Model transformer with a token classification head on top (a linear layer on top of the hidden-states
output) e.g. for Named-Entity-Recognition (NER) tasks.`,Vt,Re,To=`This model inherits from <a href="/docs/transformers/pr_30950/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.)`,Xt,Ne,vo=`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.`,Et,Z,we,Ot,Ge,ko='The <a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmForTokenClassification">StableLmForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',At,O,yt,Me,Tt,Xe,vt;return k=new U({props:{title:"StableLM",local:"stablelm",headingTag:"h1"}}),M=new U({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Q=new U({props:{title:"Model Details",local:"model-details",headingTag:"h3"}}),K=new U({props:{title:"Usage Tips",local:"usage-tips",headingTag:"h3"}}),ne=new Ee({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUyQyUyMHNldF9zZWVkJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMCUyMyUyMHRoZSUyMGRldmljZSUyMHRvJTIwbG9hZCUyMHRoZSUyMG1vZGVsJTIwb250byUwQSUwQXNldF9zZWVkKDApJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGVsbS0zYi00ZTF0JTIyKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlbG0tM2ItNGUxdCUyMiklMEFtb2RlbC50byhkZXZpY2UpJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlRoZSUyMHdlYXRoZXIlMjBpcyUyMGFsd2F5cyUyMHdvbmRlcmZ1bCUyMGluJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8obW9kZWwuZGV2aWNlKSUwQSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKm1vZGVsX2lucHV0cyUyQyUyMG1heF9sZW5ndGglM0QzMiUyQyUyMGRvX3NhbXBsZSUzRFRydWUpJTBBcmVzcG9uc2VzJTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTBBcmVzcG9uc2Vz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, set_seed
<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-comment"># the device to load the model onto</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>set_seed(<span class="hljs-number">0</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stabilityai/stablelm-3b-4e1t&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;stabilityai/stablelm-3b-4e1t&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>model_inputs = tokenizer(<span class="hljs-string">&quot;The weather is always wonderful in&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**model_inputs, max_length=<span class="hljs-number">32</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>responses = tokenizer.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>responses
[<span class="hljs-string">&#x27;The weather is always wonderful in Costa Rica, which makes it a prime destination for retirees. That’s where the Pensionado program comes in, offering&#x27;</span>]`,wrap:!1}}),ae=new U({props:{title:"Combining StableLM and Flash Attention 2",local:"combining-stablelm-and-flash-attention-2",headingTag:"h2"}}),re=new Ee({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),de=new Ee({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTJDJTIwc2V0X3NlZWQlMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwJTIzJTIwdGhlJTIwZGV2aWNlJTIwdG8lMjBsb2FkJTIwdGhlJTIwbW9kZWwlMjBvbnRvJTBBJTBBc2V0X3NlZWQoMCklMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGFiaWxpdHlhaSUyRnN0YWJsZWxtLTNiLTRlMXQlMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGVsbS0zYi00ZTF0JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUyMGF0dG5faW1wbGVtZW50YXRpb24lM0QlMjJmbGFzaF9hdHRlbnRpb25fMiUyMiklMEFtb2RlbC50byhkZXZpY2UpJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlRoZSUyMHdlYXRoZXIlMjBpcyUyMGFsd2F5cyUyMHdvbmRlcmZ1bCUyMGluJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8obW9kZWwuZGV2aWNlKSUwQSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKm1vZGVsX2lucHV0cyUyQyUyMG1heF9sZW5ndGglM0QzMiUyQyUyMGRvX3NhbXBsZSUzRFRydWUpJTBBcmVzcG9uc2VzJTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTBBcmVzcG9uc2Vz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer, set_seed
<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-comment"># the device to load the model onto</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>set_seed(<span class="hljs-number">0</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stabilityai/stablelm-3b-4e1t&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;stabilityai/stablelm-3b-4e1t&quot;</span>, torch_dtype=torch.bfloat16, attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>model_inputs = tokenizer(<span class="hljs-string">&quot;The weather is always wonderful in&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(model.device)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**model_inputs, max_length=<span class="hljs-number">32</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>responses = tokenizer.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>responses
[<span class="hljs-string">&#x27;The weather is always wonderful in Costa Rica, which makes it a prime destination for retirees. That’s where the Pensionado program comes in, offering&#x27;</span>]`,wrap:!1}}),ce=new U({props:{title:"StableLmConfig",local:"transformers.StableLmConfig",headingTag:"h2"}}),me=new G({props:{name:"class transformers.StableLmConfig",anchor:"transformers.StableLmConfig",parameters:[{name:"vocab_size",val:" = 50304"},{name:"intermediate_size",val:" = 6912"},{name:"hidden_size",val:" = 2560"},{name:"num_hidden_layers",val:" = 32"},{name:"num_attention_heads",val:" = 32"},{name:"num_key_value_heads",val:" = 32"},{name:"hidden_act",val:" = 'silu'"},{name:"max_position_embeddings",val:" = 4096"},{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:" = 10000"},{name:"rope_scaling",val:" = None"},{name:"use_qkv_bias",val:" = False"},{name:"qk_layernorm",val:" = False"},{name:"use_parallel_residual",val:" = False"},{name:"hidden_dropout",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"partial_rotary_factor",val:" = 0.25"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.StableLmConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50304) &#x2014;
Vocabulary size of the StableLM model. Defines the number of different tokens that
can be represented by the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmModel">StableLmModel</a>.`,name:"vocab_size"},{anchor:"transformers.StableLmConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 6912) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.StableLmConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2560) &#x2014;
Number of hidden layers in the Transformer decoder.`,name:"hidden_size"},{anchor:"transformers.StableLmConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of hidden layers in the Transformer decoder.`,name:"num_hidden_layers"},{anchor:"transformers.StableLmConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.StableLmConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
<code>num_key_value_heads=num_attention_heads</code>, the model will use Multi Head Attention (MHA), if
<code>num_key_value_heads=1</code> the model will use Multi Query Attention (MQA) otherwise GQA is used. When
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
by meanpooling all the original heads within that group. For more details checkout <a href="https://arxiv.org/pdf/2305.13245.pdf" rel="nofollow">this
paper</a>. If it is not specified, will default to
<code>num_attention_heads</code>.`,name:"num_key_value_heads"},{anchor:"transformers.StableLmConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string).`,name:"hidden_act"},{anchor:"transformers.StableLmConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
The maximum sequence length that this model might ever be used with.
Typically set this to something large just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.StableLmConfig.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.StableLmConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.StableLmConfig.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.StableLmConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model&#x2019;s input and output word embeddings should be tied.`,name:"tie_word_embeddings"},{anchor:"transformers.StableLmConfig.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to <code>10000.0</code>) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.StableLmConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
and you expect the model to work on longer <code>max_position_embeddings</code>, we recommend you to update this value
accordingly.
Expected contents:
<code>rope_type</code> (<code>str</code>):
The sub-variant of RoPE to use. Can be one of [&#x2018;default&#x2019;, &#x2018;linear&#x2019;, &#x2018;dynamic&#x2019;, &#x2018;yarn&#x2019;, &#x2018;longrope&#x2019;,
&#x2018;llama3&#x2019;], with &#x2018;default&#x2019; being the original RoPE implementation.
<code>factor</code> (<code>float</code>, <em>optional</em>):
Used with all rope types except &#x2018;default&#x2019;. The scaling factor to apply to the RoPE embeddings. In
most scaling types, a <code>factor</code> of x will enable the model to handle sequences of length x <em>
original maximum pre-trained length.
<code>original_max_position_embeddings</code> (<code>int</code>, </em>optional<em>):
Used with &#x2018;dynamic&#x2019;, &#x2018;longrope&#x2019; and &#x2018;llama3&#x2019;. The original max position embeddings used during
pretraining.
<code>attention_factor</code> (<code>float</code>, </em>optional<em>):
Used with &#x2018;yarn&#x2019; and &#x2018;longrope&#x2019;. The scaling factor to be applied on the attention
computation. If unspecified, it defaults to value recommended by the implementation, using the
<code>factor</code> field to infer the suggested value.
<code>beta_fast</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;yarn&#x2019;. Parameter to set the boundary for extrapolation (only) in the linear
ramp function. If unspecified, it defaults to 32.
<code>beta_slow</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;yarn&#x2019;. Parameter to set the boundary for interpolation (only) in the linear
ramp function. If unspecified, it defaults to 1.
<code>short_factor</code> (<code>List[float]</code>, </em>optional<em>):
Only used with &#x2018;longrope&#x2019;. The scaling factor to be applied to short contexts (&lt;
<code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden
size divided by the number of attention heads divided by 2
<code>long_factor</code> (<code>List[float]</code>, </em>optional<em>):
Only used with &#x2018;longrope&#x2019;. The scaling factor to be applied to long contexts (&lt;
<code>original_max_position_embeddings</code>). Must be a list of numbers with the same length as the hidden
size divided by the number of attention heads divided by 2
<code>low_freq_factor</code> (<code>float</code>, </em>optional<em>):
Only used with &#x2018;llama3&#x2019;. Scaling factor applied to low frequency components of the RoPE
<code>high_freq_factor</code> (<code>float</code>, </em>optional*):
Only used with &#x2018;llama3&#x2019;. Scaling factor applied to high frequency components of the RoPE`,name:"rope_scaling"},{anchor:"transformers.StableLmConfig.use_qkv_bias",description:`<strong>use_qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should use bias for qkv layers.`,name:"use_qkv_bias"},{anchor:"transformers.StableLmConfig.qk_layernorm",description:`<strong>qk_layernorm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to normalize, per head, the Queries and Keys after projecting the hidden states.`,name:"qk_layernorm"},{anchor:"transformers.StableLmConfig.use_parallel_residual",description:`<strong>use_parallel_residual</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a &#x201C;parallel&#x201D; formulation in each Transformer layer, which can provide a slight training
speedup at large scales.`,name:"use_parallel_residual"},{anchor:"transformers.StableLmConfig.hidden_dropout",description:`<strong>hidden_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio after applying the MLP to the hidden states.`,name:"hidden_dropout"},{anchor:"transformers.StableLmConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.StableLmConfig.partial_rotary_factor",description:`<strong>partial_rotary_factor</strong> (<code>float</code>, <em>optional</em>, defaults to 0.25) &#x2014;
Percentage of the query and keys which will have rotary embedding.`,name:"partial_rotary_factor"},{anchor:"transformers.StableLmConfig.bos_token_id",description:`<strong>bos_token_id</strong> (int, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>BOS</code> token in the vocabulary.`,name:"bos_token_id"},{anchor:"transformers.StableLmConfig.eos_token_id",description:`<strong>eos_token_id</strong> (int, <em>optional</em>, defaults to 0) &#x2014;
The id of the <code>EOS</code> token in the vocabulary.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/stablelm/configuration_stablelm.py#L25"}}),B=new wo({props:{anchor:"transformers.StableLmConfig.example",$$slots:{default:[zo]},$$scope:{ctx:x}}}),pe=new U({props:{title:"StableLmModel",local:"transformers.StableLmModel",headingTag:"h2"}}),he=new G({props:{name:"class transformers.StableLmModel",anchor:"transformers.StableLmModel",parameters:[{name:"config",val:": StableLmConfig"}],parametersDescription:[{anchor:"transformers.StableLmModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmConfig">StableLmConfig</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/pr_30950/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.
config &#x2014; StableLmConfig`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L895"}}),ue=new G({props:{name:"forward",anchor:"transformers.StableLmModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"cache_position",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.StableLmModel.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmModel.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmModel.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.StableLmModel.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/pr_30950/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</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.StableLmModel.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.StableLmModel.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.StableLmModel.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.StableLmModel.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.StableLmModel.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/pr_30950/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.StableLmModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L930"}}),H=new kt({props:{$$slots:{default:[Fo]},$$scope:{ctx:x}}}),fe=new U({props:{title:"StableLmForCausalLM",local:"transformers.StableLmForCausalLM",headingTag:"h2"}}),ge=new G({props:{name:"class transformers.StableLmForCausalLM",anchor:"transformers.StableLmForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L1127"}}),_e=new G({props:{name:"forward",anchor:"transformers.StableLmForCausalLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"},{name:"cache_position",val:": Optional = None"},{name:"num_logits_to_keep",val:": int = 0"}],parametersDescription:[{anchor:"transformers.StableLmForCausalLM.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmForCausalLM.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmForCausalLM.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.StableLmForCausalLM.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/pr_30950/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</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.StableLmForCausalLM.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.StableLmForCausalLM.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.StableLmForCausalLM.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.StableLmForCausalLM.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.StableLmForCausalLM.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/pr_30950/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.StableLmForCausalLM.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.</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>.</p>
<p>num_logits_to_keep (<code>int</code>, <em>optional</em>):
Calculate logits for the last <code>num_logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all
<code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L1164",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_30950/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/pr_30950/en/model_doc/stablelm#transformers.StableLmConfig"
>StableLmConfig</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/pr_30950/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),V=new kt({props:{$$slots:{default:[Io]},$$scope:{ctx:x}}}),X=new wo({props:{anchor:"transformers.StableLmForCausalLM.forward.example",$$slots:{default:[qo]},$$scope:{ctx:x}}}),be=new U({props:{title:"StableLmForSequenceClassification",local:"transformers.StableLmForSequenceClassification",headingTag:"h2"}}),ye=new G({props:{name:"class transformers.StableLmForSequenceClassification",anchor:"transformers.StableLmForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.StableLmForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmConfig">StableLmConfig</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/pr_30950/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/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L1337"}}),Te=new G({props:{name:"forward",anchor:"transformers.StableLmForSequenceClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Union = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.StableLmForSequenceClassification.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmForSequenceClassification.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmForSequenceClassification.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.StableLmForSequenceClassification.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/pr_30950/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</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.StableLmForSequenceClassification.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.StableLmForSequenceClassification.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.StableLmForSequenceClassification.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.StableLmForSequenceClassification.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.StableLmForSequenceClassification.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/pr_30950/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.StableLmForSequenceClassification.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.StableLmForSequenceClassification.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/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L1369"}}),E=new kt({props:{$$slots:{default:[Jo]},$$scope:{ctx:x}}}),ve=new U({props:{title:"StableLmForTokenClassification",local:"transformers.StableLmForTokenClassification",headingTag:"h2"}}),ke=new G({props:{name:"class transformers.StableLmForTokenClassification",anchor:"transformers.StableLmForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.StableLmForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_30950/en/model_doc/stablelm#transformers.StableLmConfig">StableLmConfig</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/pr_30950/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/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L1461"}}),we=new G({props:{name:"forward",anchor:"transformers.StableLmForTokenClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"use_cache",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.StableLmForTokenClassification.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmForTokenClassification.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/pr_30950/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_30950/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__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.StableLmForTokenClassification.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.StableLmForTokenClassification.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/pr_30950/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our
<a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</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.StableLmForTokenClassification.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.StableLmForTokenClassification.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.StableLmForTokenClassification.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.StableLmForTokenClassification.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.StableLmForTokenClassification.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/pr_30950/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.StableLmForTokenClassification.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.StableLmForTokenClassification.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/vr_30950/src/transformers/models/stablelm/modeling_stablelm.py#L1492"}}),O=new kt({props:{$$slots:{default:[Wo]},$$scope:{ctx:x}}}),Me=new Co({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/stablelm.md"}}),{c(){s=l("meta"),T=n(),c=l("p"),y=n(),h(k.$$.fragment),m=n(),h(M.$$.fragment),Oe=n(),A=l("p"),A.innerHTML=Qt,Ae=n(),h(Q.$$.fragment),Qe=n(),D=l("p"),D.innerHTML=Dt,De=n(),Y=l("p"),Y.innerHTML=Yt,Ye=n(),h(K.$$.fragment),Ke=n(),ee=l("ul"),ee.innerHTML=Kt,et=n(),te=l("p"),te.innerHTML=eo,tt=n(),oe=l("p"),oe.innerHTML=to,ot=n(),h(ne.$$.fragment),nt=n(),h(ae.$$.fragment),at=n(),se=l("p"),se.textContent=oo,st=n(),h(re.$$.fragment),rt=n(),ie=l("p"),ie.innerHTML=no,it=n(),le=l("p"),le.textContent=ao,lt=n(),h(de.$$.fragment),dt=n(),h(ce.$$.fragment),ct=n(),S=l("div"),h(me.$$.fragment),wt=n(),Le=l("p"),Le.innerHTML=so,Mt=n(),xe=l("p"),xe.innerHTML=ro,$t=n(),h(B.$$.fragment),mt=n(),h(pe.$$.fragment),pt=n(),$=l("div"),h(he.$$.fragment),Lt=n(),Se=l("p"),Se.innerHTML=io,xt=n(),Ce=l("p"),Ce.innerHTML=lo,St=n(),ze=l("p"),ze.innerHTML=co,Ct=n(),W=l("div"),h(ue.$$.fragment),zt=n(),Fe=l("p"),Fe.innerHTML=mo,Ft=n(),h(H.$$.fragment),ht=n(),h(fe.$$.fragment),ut=n(),R=l("div"),h(ge.$$.fragment),It=n(),z=l("div"),h(_e.$$.fragment),qt=n(),Ie=l("p"),Ie.innerHTML=po,Jt=n(),h(V.$$.fragment),Wt=n(),h(X.$$.fragment),ft=n(),h(be.$$.fragment),gt=n(),v=l("div"),h(ye.$$.fragment),jt=n(),qe=l("p"),qe.textContent=ho,Zt=n(),Je=l("p"),Je.innerHTML=uo,Pt=n(),We=l("p"),We.innerHTML=fo,Ut=n(),je=l("p"),je.innerHTML=go,Rt=n(),Ze=l("p"),Ze.innerHTML=_o,Nt=n(),j=l("div"),h(Te.$$.fragment),Gt=n(),Pe=l("p"),Pe.innerHTML=bo,Bt=n(),h(E.$$.fragment),_t=n(),h(ve.$$.fragment),bt=n(),L=l("div"),h(ke.$$.fragment),Ht=n(),Ue=l("p"),Ue.textContent=yo,Vt=n(),Re=l("p"),Re.innerHTML=To,Xt=n(),Ne=l("p"),Ne.innerHTML=vo,Et=n(),Z=l("div"),h(we.$$.fragment),Ot=n(),Ge=l("p"),Ge.innerHTML=ko,At=n(),h(O.$$.fragment),yt=n(),h(Me.$$.fragment),Tt=n(),Xe=l("p"),this.h()},l(e){const t=So("svelte-u9bgzb",document.head);s=d(t,"META",{name:!0,content:!0}),t.forEach(o),T=a(e),c=d(e,"P",{}),q(c).forEach(o),y=a(e),u(k.$$.fragment,e),m=a(e),u(M.$$.fragment,e),Oe=a(e),A=d(e,"P",{"data-svelte-h":!0}),p(A)!=="svelte-p70wk3"&&(A.innerHTML=Qt),Ae=a(e),u(Q.$$.fragment,e),Qe=a(e),D=d(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-13e6wpg"&&(D.innerHTML=Dt),De=a(e),Y=d(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-ecv3xy"&&(Y.innerHTML=Yt),Ye=a(e),u(K.$$.fragment,e),Ke=a(e),ee=d(e,"UL",{"data-svelte-h":!0}),p(ee)!=="svelte-8q6i0i"&&(ee.innerHTML=Kt),et=a(e),te=d(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-1a9jefj"&&(te.innerHTML=eo),tt=a(e),oe=d(e,"P",{"data-svelte-h":!0}),p(oe)!=="svelte-udtc57"&&(oe.innerHTML=to),ot=a(e),u(ne.$$.fragment,e),nt=a(e),u(ae.$$.fragment,e),at=a(e),se=d(e,"P",{"data-svelte-h":!0}),p(se)!=="svelte-pstkbw"&&(se.textContent=oo),st=a(e),u(re.$$.fragment,e),rt=a(e),ie=d(e,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-8b9qy3"&&(ie.innerHTML=no),it=a(e),le=d(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-1w2ttra"&&(le.textContent=ao),lt=a(e),u(de.$$.fragment,e),dt=a(e),u(ce.$$.fragment,e),ct=a(e),S=d(e,"DIV",{class:!0});var F=q(S);u(me.$$.fragment,F),wt=a(F),Le=d(F,"P",{"data-svelte-h":!0}),p(Le)!=="svelte-159n2gy"&&(Le.innerHTML=so),Mt=a(F),xe=d(F,"P",{"data-svelte-h":!0}),p(xe)!=="svelte-ghb0nx"&&(xe.innerHTML=ro),$t=a(F),u(B.$$.fragment,F),F.forEach(o),mt=a(e),u(pe.$$.fragment,e),pt=a(e),$=d(e,"DIV",{class:!0});var C=q($);u(he.$$.fragment,C),Lt=a(C),Se=d(C,"P",{"data-svelte-h":!0}),p(Se)!=="svelte-1eqaerv"&&(Se.innerHTML=io),xt=a(C),Ce=d(C,"P",{"data-svelte-h":!0}),p(Ce)!=="svelte-hswkmf"&&(Ce.innerHTML=lo),St=a(C),ze=d(C,"P",{"data-svelte-h":!0}),p(ze)!=="svelte-12wkov7"&&(ze.innerHTML=co),Ct=a(C),W=d(C,"DIV",{class:!0});var N=q(W);u(ue.$$.fragment,N),zt=a(N),Fe=d(N,"P",{"data-svelte-h":!0}),p(Fe)!=="svelte-1bxr6q6"&&(Fe.innerHTML=mo),Ft=a(N),u(H.$$.fragment,N),N.forEach(o),C.forEach(o),ht=a(e),u(fe.$$.fragment,e),ut=a(e),R=d(e,"DIV",{class:!0});var $e=q(R);u(ge.$$.fragment,$e),It=a($e),z=d($e,"DIV",{class:!0});var I=q(z);u(_e.$$.fragment,I),qt=a(I),Ie=d(I,"P",{"data-svelte-h":!0}),p(Ie)!=="svelte-2x9qj6"&&(Ie.innerHTML=po),Jt=a(I),u(V.$$.fragment,I),Wt=a(I),u(X.$$.fragment,I),I.forEach(o),$e.forEach(o),ft=a(e),u(be.$$.fragment,e),gt=a(e),v=d(e,"DIV",{class:!0});var w=q(v);u(ye.$$.fragment,w),jt=a(w),qe=d(w,"P",{"data-svelte-h":!0}),p(qe)!=="svelte-1r4bxkh"&&(qe.textContent=ho),Zt=a(w),Je=d(w,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-kxmd0n"&&(Je.innerHTML=uo),Pt=a(w),We=d(w,"P",{"data-svelte-h":!0}),p(We)!=="svelte-10ugs3m"&&(We.innerHTML=fo),Ut=a(w),je=d(w,"P",{"data-svelte-h":!0}),p(je)!=="svelte-19qbfzz"&&(je.innerHTML=go),Rt=a(w),Ze=d(w,"P",{"data-svelte-h":!0}),p(Ze)!=="svelte-hswkmf"&&(Ze.innerHTML=_o),Nt=a(w),j=d(w,"DIV",{class:!0});var Be=q(j);u(Te.$$.fragment,Be),Gt=a(Be),Pe=d(Be,"P",{"data-svelte-h":!0}),p(Pe)!=="svelte-rek1ty"&&(Pe.innerHTML=bo),Bt=a(Be),u(E.$$.fragment,Be),Be.forEach(o),w.forEach(o),_t=a(e),u(ve.$$.fragment,e),bt=a(e),L=d(e,"DIV",{class:!0});var P=q(L);u(ke.$$.fragment,P),Ht=a(P),Ue=d(P,"P",{"data-svelte-h":!0}),p(Ue)!=="svelte-ioez1z"&&(Ue.textContent=yo),Vt=a(P),Re=d(P,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-19qbfzz"&&(Re.innerHTML=To),Xt=a(P),Ne=d(P,"P",{"data-svelte-h":!0}),p(Ne)!=="svelte-hswkmf"&&(Ne.innerHTML=vo),Et=a(P),Z=d(P,"DIV",{class:!0});var He=q(Z);u(we.$$.fragment,He),Ot=a(He),Ge=d(He,"P",{"data-svelte-h":!0}),p(Ge)!=="svelte-risci6"&&(Ge.innerHTML=ko),At=a(He),u(O.$$.fragment,He),He.forEach(o),P.forEach(o),yt=a(e),u(Me.$$.fragment,e),Tt=a(e),Xe=d(e,"P",{}),q(Xe).forEach(o),this.h()},h(){J(s,"name","hf:doc:metadata"),J(s,"content",Zo),J(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),J(L,"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){i(document.head,s),r(e,T,t),r(e,c,t),r(e,y,t),f(k,e,t),r(e,m,t),f(M,e,t),r(e,Oe,t),r(e,A,t),r(e,Ae,t),f(Q,e,t),r(e,Qe,t),r(e,D,t),r(e,De,t),r(e,Y,t),r(e,Ye,t),f(K,e,t),r(e,Ke,t),r(e,ee,t),r(e,et,t),r(e,te,t),r(e,tt,t),r(e,oe,t),r(e,ot,t),f(ne,e,t),r(e,nt,t),f(ae,e,t),r(e,at,t),r(e,se,t),r(e,st,t),f(re,e,t),r(e,rt,t),r(e,ie,t),r(e,it,t),r(e,le,t),r(e,lt,t),f(de,e,t),r(e,dt,t),f(ce,e,t),r(e,ct,t),r(e,S,t),f(me,S,null),i(S,wt),i(S,Le),i(S,Mt),i(S,xe),i(S,$t),f(B,S,null),r(e,mt,t),f(pe,e,t),r(e,pt,t),r(e,$,t),f(he,$,null),i($,Lt),i($,Se),i($,xt),i($,Ce),i($,St),i($,ze),i($,Ct),i($,W),f(ue,W,null),i(W,zt),i(W,Fe),i(W,Ft),f(H,W,null),r(e,ht,t),f(fe,e,t),r(e,ut,t),r(e,R,t),f(ge,R,null),i(R,It),i(R,z),f(_e,z,null),i(z,qt),i(z,Ie),i(z,Jt),f(V,z,null),i(z,Wt),f(X,z,null),r(e,ft,t),f(be,e,t),r(e,gt,t),r(e,v,t),f(ye,v,null),i(v,jt),i(v,qe),i(v,Zt),i(v,Je),i(v,Pt),i(v,We),i(v,Ut),i(v,je),i(v,Rt),i(v,Ze),i(v,Nt),i(v,j),f(Te,j,null),i(j,Gt),i(j,Pe),i(j,Bt),f(E,j,null),r(e,_t,t),f(ve,e,t),r(e,bt,t),r(e,L,t),f(ke,L,null),i(L,Ht),i(L,Ue),i(L,Vt),i(L,Re),i(L,Xt),i(L,Ne),i(L,Et),i(L,Z),f(we,Z,null),i(Z,Ot),i(Z,Ge),i(Z,At),f(O,Z,null),r(e,yt,t),f(Me,e,t),r(e,Tt,t),r(e,Xe,t),vt=!0},p(e,[t]){const F={};t&2&&(F.$$scope={dirty:t,ctx:e}),B.$set(F);const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),H.$set(C);const N={};t&2&&(N.$$scope={dirty:t,ctx:e}),V.$set(N);const $e={};t&2&&($e.$$scope={dirty:t,ctx:e}),X.$set($e);const I={};t&2&&(I.$$scope={dirty:t,ctx:e}),E.$set(I);const w={};t&2&&(w.$$scope={dirty:t,ctx:e}),O.$set(w)},i(e){vt||(g(k.$$.fragment,e),g(M.$$.fragment,e),g(Q.$$.fragment,e),g(K.$$.fragment,e),g(ne.$$.fragment,e),g(ae.$$.fragment,e),g(re.$$.fragment,e),g(de.$$.fragment,e),g(ce.$$.fragment,e),g(me.$$.fragment,e),g(B.$$.fragment,e),g(pe.$$.fragment,e),g(he.$$.fragment,e),g(ue.$$.fragment,e),g(H.$$.fragment,e),g(fe.$$.fragment,e),g(ge.$$.fragment,e),g(_e.$$.fragment,e),g(V.$$.fragment,e),g(X.$$.fragment,e),g(be.$$.fragment,e),g(ye.$$.fragment,e),g(Te.$$.fragment,e),g(E.$$.fragment,e),g(ve.$$.fragment,e),g(ke.$$.fragment,e),g(we.$$.fragment,e),g(O.$$.fragment,e),g(Me.$$.fragment,e),vt=!0)},o(e){_(k.$$.fragment,e),_(M.$$.fragment,e),_(Q.$$.fragment,e),_(K.$$.fragment,e),_(ne.$$.fragment,e),_(ae.$$.fragment,e),_(re.$$.fragment,e),_(de.$$.fragment,e),_(ce.$$.fragment,e),_(me.$$.fragment,e),_(B.$$.fragment,e),_(pe.$$.fragment,e),_(he.$$.fragment,e),_(ue.$$.fragment,e),_(H.$$.fragment,e),_(fe.$$.fragment,e),_(ge.$$.fragment,e),_(_e.$$.fragment,e),_(V.$$.fragment,e),_(X.$$.fragment,e),_(be.$$.fragment,e),_(ye.$$.fragment,e),_(Te.$$.fragment,e),_(E.$$.fragment,e),_(ve.$$.fragment,e),_(ke.$$.fragment,e),_(we.$$.fragment,e),_(O.$$.fragment,e),_(Me.$$.fragment,e),vt=!1},d(e){e&&(o(T),o(c),o(y),o(m),o(Oe),o(A),o(Ae),o(Qe),o(D),o(De),o(Y),o(Ye),o(Ke),o(ee),o(et),o(te),o(tt),o(oe),o(ot),o(nt),o(at),o(se),o(st),o(rt),o(ie),o(it),o(le),o(lt),o(dt),o(ct),o(S),o(mt),o(pt),o($),o(ht),o(ut),o(R),o(ft),o(gt),o(v),o(_t),o(bt),o(L),o(yt),o(Tt),o(Xe)),o(s),b(k,e),b(M,e),b(Q,e),b(K,e),b(ne,e),b(ae,e),b(re,e),b(de,e),b(ce,e),b(me),b(B),b(pe,e),b(he),b(ue),b(H),b(fe,e),b(ge),b(_e),b(V),b(X),b(be,e),b(ye),b(Te),b(E),b(ve,e),b(ke),b(we),b(O),b(Me,e)}}}const Zo='{"title":"StableLM","local":"stablelm","sections":[{"title":"Overview","local":"overview","sections":[{"title":"Model Details","local":"model-details","sections":[],"depth":3},{"title":"Usage Tips","local":"usage-tips","sections":[],"depth":3}],"depth":2},{"title":"Combining StableLM and Flash Attention 2","local":"combining-stablelm-and-flash-attention-2","sections":[],"depth":2},{"title":"StableLmConfig","local":"transformers.StableLmConfig","sections":[],"depth":2},{"title":"StableLmModel","local":"transformers.StableLmModel","sections":[],"depth":2},{"title":"StableLmForCausalLM","local":"transformers.StableLmForCausalLM","sections":[],"depth":2},{"title":"StableLmForSequenceClassification","local":"transformers.StableLmForSequenceClassification","sections":[],"depth":2},{"title":"StableLmForTokenClassification","local":"transformers.StableLmForTokenClassification","sections":[],"depth":2}],"depth":1}';function Po(x){return $o(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xo extends Lo{constructor(s){super(),xo(this,s,Po,jo,Mo,{})}}export{Xo as component};
