import{s as kt,o as wt,n as ve}from"../chunks/scheduler.25b97de1.js";import{S as Mt,i as $t,g as h,s as i,r as g,A as Pt,h as m,f as a,c as d,j as D,u as _,x as w,k as Y,y as l,a as p,v as b,d as y,t as T,w as v}from"../chunks/index.d9030fc9.js";import{T as Qe}from"../chunks/Tip.baa67368.js";import{D as ce}from"../chunks/Docstring.e257edda.js";import{C as et}from"../chunks/CodeBlock.e6cd0d95.js";import{F as Ct,M as xt}from"../chunks/Markdown.7217f838.js";import{E as mt}from"../chunks/ExampleCodeBlock.20db4b6e.js";import{H as pe,E as zt}from"../chunks/EditOnGithub.91d95064.js";function jt($){let t,u="Phi-3 has been integrated in the development version (4.40.0.dev) of <code>transformers</code>. Until the official version is released through <code>pip</code>, ensure that you are doing one of the following:",o,r,k="<li><p>When loading the model, ensure that <code>trust_remote_code=True</code> is passed as an argument of the <code>from_pretrained()</code> function.</p></li> <li><p>Update your local <code>transformers</code> to the development version: <code>pip uninstall -y transformers &amp;&amp; pip install git+https://github.com/huggingface/transformers</code>. The previous command is an alternative to cloning and installing from the source.</p></li>";return{c(){t=h("p"),t.innerHTML=u,o=i(),r=h("ul"),r.innerHTML=k},l(s){t=m(s,"P",{"data-svelte-h":!0}),w(t)!=="svelte-c51ot7"&&(t.innerHTML=u),o=d(s),r=m(s,"UL",{"data-svelte-h":!0}),w(r)!=="svelte-1ysocqo"&&(r.innerHTML=k)},m(s,M){p(s,t,M),p(s,o,M),p(s,r,M)},p:ve,d(s){s&&(a(t),a(o),a(r))}}}function Ft($){let t,u="Example:",o,r,k;return r=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBoaTNNb2RlbCUyQyUyMFBoaTNDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUGhpLTMlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwUGhpM0NvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGUGhpLTMtbWluaS00ay1pbnN0cnVjdCUyMiklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjBmcm9tJTIwdGhlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwUGhpM01vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Phi3Model, Phi3Config

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Phi-3 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Phi3Config.from_pretrained(<span class="hljs-string">&quot;microsoft/Phi-3-mini-4k-instruct&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Phi3Model(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){t=h("p"),t.textContent=u,o=i(),g(r.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),w(t)!=="svelte-11lpom8"&&(t.textContent=u),o=d(s),_(r.$$.fragment,s)},m(s,M){p(s,t,M),p(s,o,M),b(r,s,M),k=!0},p:ve,i(s){k||(y(r.$$.fragment,s),k=!0)},o(s){T(r.$$.fragment,s),k=!1},d(s){s&&(a(t),a(o)),v(r,s)}}}function Lt($){let t,u=`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(){t=h("p"),t.innerHTML=u},l(o){t=m(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(o,r){p(o,t,r)},p:ve,d(o){o&&a(t)}}}function It($){let t,u=`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(){t=h("p"),t.innerHTML=u},l(o){t=m(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(o,r){p(o,t,r)},p:ve,d(o){o&&a(t)}}}function Ut($){let t,u="Example:",o,r,k;return r=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBQaGkzRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFBoaTNGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGcGhpLTMtbWluaS00ay1pbnN0cnVjdCUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZwaGktMy1taW5pLTRrLWluc3RydWN0JTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMlRoaXMlMjBpcyUyMGFuJTIwZXhhbXBsZSUyMHNjcmlwdCUyMC4lMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocHJvbXB0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBHZW5lcmF0ZSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cy5pbnB1dF9pZHMlMkMlMjBtYXhfbGVuZ3RoJTNEMzApJTBBdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, Phi3ForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Phi3ForCausalLM.from_pretrained(<span class="hljs-string">&quot;microsoft/phi-3-mini-4k-instruct&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/phi-3-mini-4k-instruct&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;This is an example script .&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;This is an example script .\\n Certainly! Below is a sample script that demonstrates a simple task, such as calculating the sum&#x27;</span>`,wrap:!1}}),{c(){t=h("p"),t.textContent=u,o=i(),g(r.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),w(t)!=="svelte-11lpom8"&&(t.textContent=u),o=d(s),_(r.$$.fragment,s)},m(s,M){p(s,t,M),p(s,o,M),b(r,s,M),k=!0},p:ve,i(s){k||(y(r.$$.fragment,s),k=!0)},o(s){T(r.$$.fragment,s),k=!1},d(s){s&&(a(t),a(o)),v(r,s)}}}function qt($){let t,u=`Most generation-controlling parameters are set in <code>generation_config</code> which, if not passed, will be set to the
model’s default generation configuration. You can override any <code>generation_config</code> by passing the corresponding
parameters to generate(), e.g. <code>.generate(inputs, num_beams=4, do_sample=True)</code>.`,o,r,k=`For an overview of generation strategies and code examples, check out the <a href="../generation_strategies">following
guide</a>.`;return{c(){t=h("p"),t.innerHTML=u,o=i(),r=h("p"),r.innerHTML=k},l(s){t=m(s,"P",{"data-svelte-h":!0}),w(t)!=="svelte-1c5u34l"&&(t.innerHTML=u),o=d(s),r=m(s,"P",{"data-svelte-h":!0}),w(r)!=="svelte-fvlq1g"&&(r.innerHTML=k)},m(s,M){p(s,t,M),p(s,o,M),p(s,r,M)},p:ve,d(s){s&&(a(t),a(o),a(r))}}}function Wt($){let t,u=`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(){t=h("p"),t.innerHTML=u},l(o){t=m(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(o,r){p(o,t,r)},p:ve,d(o){o&&a(t)}}}function Nt($){let t,u=`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(){t=h("p"),t.innerHTML=u},l(o){t=m(o,"P",{"data-svelte-h":!0}),w(t)!=="svelte-fincs2"&&(t.innerHTML=u)},m(o,r){p(o,t,r)},p:ve,d(o){o&&a(t)}}}function Gt($){let t,u="Example:",o,r,k;return r=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBQaGkzRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGUGhpLTMtbWluaS00ay1pbnN0cnVjdCUyMiklMEFtb2RlbCUyMCUzRCUyMFBoaTNGb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZQaGktMy1taW5pLTRrLWluc3RydWN0JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJIdWdnaW5nRmFjZSUyMGlzJTIwYSUyMGNvbXBhbnklMjBiYXNlZCUyMGluJTIwUGFyaXMlMjBhbmQlMjBOZXclMjBZb3JrJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpJTBBJTBBJTIzJTIwTm90ZSUyMHRoYXQlMjB0b2tlbnMlMjBhcmUlMjBjbGFzc2lmaWVkJTIwcmF0aGVyJTIwdGhlbiUyMGlucHV0JTIwd29yZHMlMjB3aGljaCUyMG1lYW5zJTIwdGhhdCUwQSUyMyUyMHRoZXJlJTIwbWlnaHQlMjBiZSUyMG1vcmUlMjBwcmVkaWN0ZWQlMjB0b2tlbiUyMGNsYXNzZXMlMjB0aGFuJTIwd29yZHMuJTBBJTIzJTIwTXVsdGlwbGUlMjB0b2tlbiUyMGNsYXNzZXMlMjBtaWdodCUyMGFjY291bnQlMjBmb3IlMjB0aGUlMjBzYW1lJTIwd29yZCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1Qm1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnQuaXRlbSgpJTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQlNUQlMEElMEFsYWJlbHMlMjAlM0QlMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3Nz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, Phi3ForTokenClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/Phi-3-mini-4k-instruct&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Phi3ForTokenClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/Phi-3-mini-4k-instruct&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># there might be more predicted token classes than words.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Multiple token classes might account for the same word</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_tokens_classes = [model.config.id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = predicted_token_class_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){t=h("p"),t.textContent=u,o=i(),g(r.$$.fragment)},l(s){t=m(s,"P",{"data-svelte-h":!0}),w(t)!=="svelte-11lpom8"&&(t.textContent=u),o=d(s),_(r.$$.fragment,s)},m(s,M){p(s,t,M),p(s,o,M),b(r,s,M),k=!0},p:ve,i(s){k||(y(r.$$.fragment,s),k=!0)},o(s){T(r.$$.fragment,s),k=!1},d(s){s&&(a(t),a(o)),v(r,s)}}}function Jt($){let t,u,o,r,k,s,M=`The bare Phi-3 model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/pr_31098/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.)`,ke,q,Ae=`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.`,we,W,Le="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>Phi3DecoderLayer</code>",K,B,O,ee,he,Ie='The <a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3Model">Phi3Model</a> forward method, overrides the <code>__call__</code> special method.',te,ne,me,L,ue,z,re,Me,x,X,E,oe,ie='The <a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3ForCausalLM">Phi3ForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',$e,F,Pe,C,se,N,G,Je,de,fe="Generates sequences of token ids for models with a language modeling head.",Be,R,Z,V,H,P,I,Ce,Q,Ue='The <a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3Model">Phi3Model</a> with a sequence classification head on top (linear layer).',e,c,J=`<a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3ForSequenceClassification">Phi3ForSequenceClassification</a> uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`,Ze,ge,ut=`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).`,tt,He,ft=`This model inherits from <a href="/docs/transformers/pr_31098/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.)`,nt,Se,gt=`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.`,ot,le,qe,st,Oe,_t='The <a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3ForSequenceClassification">Phi3ForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',at,xe,De,We,Ye,U,Ne,rt,Xe,bt=`<a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3Model">Phi3Model</a> 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.`,it,Ee,yt=`This model inherits from <a href="/docs/transformers/pr_31098/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.)`,dt,Re,Tt=`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.`,lt,A,Ge,ct,Ve,vt='The <a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3ForTokenClassification">Phi3ForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',pt,ze,ht,je,Ke;return t=new pe({props:{title:"Phi3Model",local:"transformers.Phi3Model",headingTag:"h2"}}),r=new ce({props:{name:"class transformers.Phi3Model",anchor:"transformers.Phi3Model",parameters:[{name:"config",val:": Phi3Config"}],parametersDescription:[{anchor:"transformers.Phi3Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3Config">Phi3Config</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_31098/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.
config &#x2014; Phi3Config`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/phi3/modeling_phi3.py#L932"}}),O=new ce({props:{name:"forward",anchor:"transformers.Phi3Model.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.Phi3Model.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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.Phi3Model.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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>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.Phi3Model.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.Phi3Model.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_31098/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.Phi3Model.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.Phi3Model.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.Phi3Model.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.Phi3Model.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.Phi3Model.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_31098/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Phi3Model.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_31098/src/transformers/models/phi3/modeling_phi3.py#L967"}}),ne=new Qe({props:{$$slots:{default:[Lt]},$$scope:{ctx:$}}}),L=new pe({props:{title:"Phi3ForCausalLM",local:"transformers.Phi3ForCausalLM",headingTag:"h2"}}),re=new ce({props:{name:"class transformers.Phi3ForCausalLM",anchor:"transformers.Phi3ForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/phi3/modeling_phi3.py#L1157"}}),X=new ce({props:{name:"forward",anchor:"transformers.Phi3ForCausalLM.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"}],parametersDescription:[{anchor:"transformers.Phi3ForCausalLM.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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.Phi3ForCausalLM.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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>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.Phi3ForCausalLM.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.Phi3ForCausalLM.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_31098/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.Phi3ForCausalLM.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.Phi3ForCausalLM.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.Phi3ForCausalLM.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.Phi3ForCausalLM.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.Phi3ForCausalLM.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_31098/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Phi3ForCausalLM.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>.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/phi3/modeling_phi3.py#L1195",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_31098/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_31098/en/model_doc/phi3#transformers.Phi3Config"
>Phi3Config</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_31098/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),F=new Qe({props:{$$slots:{default:[It]},$$scope:{ctx:$}}}),C=new mt({props:{anchor:"transformers.Phi3ForCausalLM.forward.example",$$slots:{default:[Ut]},$$scope:{ctx:$}}}),G=new ce({props:{name:"generate",anchor:"transformers.Phi3ForCausalLM.generate",parameters:[{name:"inputs",val:": Optional = None"},{name:"generation_config",val:": Optional = None"},{name:"logits_processor",val:": Optional = None"},{name:"stopping_criteria",val:": Optional = None"},{name:"prefix_allowed_tokens_fn",val:": Optional = None"},{name:"synced_gpus",val:": Optional = None"},{name:"assistant_model",val:": Optional = None"},{name:"streamer",val:": Optional = None"},{name:"negative_prompt_ids",val:": Optional = None"},{name:"negative_prompt_attention_mask",val:": Optional = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Phi3ForCausalLM.generate.inputs",description:`<strong>inputs</strong> (<code>torch.Tensor</code> of varying shape depending on the modality, <em>optional</em>) &#x2014;
The sequence used as a prompt for the generation or as model inputs to the encoder. If <code>None</code> the
method initializes it with <code>bos_token_id</code> and a batch size of 1. For decoder-only models <code>inputs</code>
should be in the format of <code>input_ids</code>. For encoder-decoder models <em>inputs</em> can represent any of
<code>input_ids</code>, <code>input_values</code>, <code>input_features</code>, or <code>pixel_values</code>.`,name:"inputs"},{anchor:"transformers.Phi3ForCausalLM.generate.generation_config",description:`<strong>generation_config</strong> (<a href="/docs/transformers/pr_31098/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a>, <em>optional</em>) &#x2014;
The generation configuration to be used as base parametrization for the generation call. <code>**kwargs</code>
passed to generate matching the attributes of <code>generation_config</code> will override them. If
<code>generation_config</code> is not provided, the default will be used, which has the following loading
priority: 1) from the <code>generation_config.json</code> model file, if it exists; 2) from the model
configuration. Please note that unspecified parameters will inherit <a href="/docs/transformers/pr_31098/en/main_classes/text_generation#transformers.GenerationConfig">GenerationConfig</a>&#x2019;s
default values, whose documentation should be checked to parameterize generation.`,name:"generation_config"},{anchor:"transformers.Phi3ForCausalLM.generate.logits_processor",description:`<strong>logits_processor</strong> (<code>LogitsProcessorList</code>, <em>optional</em>) &#x2014;
Custom logits processors that complement the default logits processors built from arguments and
generation config. If a logit processor is passed that is already created with the arguments or a
generation config an error is thrown. This feature is intended for advanced users.`,name:"logits_processor"},{anchor:"transformers.Phi3ForCausalLM.generate.stopping_criteria",description:`<strong>stopping_criteria</strong> (<code>StoppingCriteriaList</code>, <em>optional</em>) &#x2014;
Custom stopping criteria that complements the default stopping criteria built from arguments and a
generation config. If a stopping criteria is passed that is already created with the arguments or a
generation config an error is thrown. If your stopping criteria depends on the <code>scores</code> input, make
sure you pass <code>return_dict_in_generate=True, output_scores=True</code> to <code>generate</code>. This feature is
intended for advanced users.`,name:"stopping_criteria"},{anchor:"transformers.Phi3ForCausalLM.generate.prefix_allowed_tokens_fn",description:`<strong>prefix_allowed_tokens_fn</strong> (<code>Callable[[int, torch.Tensor], List[int]]</code>, <em>optional</em>) &#x2014;
If provided, this function constraints the beam search to allowed tokens only at each step. If not
provided no constraint is applied. This function takes 2 arguments: the batch ID <code>batch_id</code> and
<code>input_ids</code>. It has to return a list with the allowed tokens for the next generation step conditioned
on the batch ID <code>batch_id</code> and the previously generated tokens <code>inputs_ids</code>. This argument is useful
for constrained generation conditioned on the prefix, as described in <a href="https://arxiv.org/abs/2010.00904" rel="nofollow">Autoregressive Entity
Retrieval</a>.`,name:"prefix_allowed_tokens_fn"},{anchor:"transformers.Phi3ForCausalLM.generate.synced_gpus",description:`<strong>synced_gpus</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to continue running the while loop until max_length. Unless overridden this flag will be set to
<code>True</code> under DeepSpeed ZeRO Stage 3 multiple GPUs environment to avoid hanging if one GPU finished
generating before other GPUs. Otherwise it&#x2019;ll be set to <code>False</code>.`,name:"synced_gpus"},{anchor:"transformers.Phi3ForCausalLM.generate.assistant_model",description:`<strong>assistant_model</strong> (<code>PreTrainedModel</code>, <em>optional</em>) &#x2014;
An assistant model that can be used to accelerate generation. The assistant model must have the exact
same tokenizer. The acceleration is achieved when forecasting candidate tokens with the assistent model
is much faster than running generation with the model you&#x2019;re calling generate from. As such, the
assistant model should be much smaller.`,name:"assistant_model"},{anchor:"transformers.Phi3ForCausalLM.generate.streamer",description:`<strong>streamer</strong> (<code>BaseStreamer</code>, <em>optional</em>) &#x2014;
Streamer object that will be used to stream the generated sequences. Generated tokens are passed
through <code>streamer.put(token_ids)</code> and the streamer is responsible for any further processing.`,name:"streamer"},{anchor:"transformers.Phi3ForCausalLM.generate.negative_prompt_ids",description:`<strong>negative_prompt_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
The negative prompt needed for some processors such as CFG. The batch size must match the input batch
size. This is an experimental feature, subject to breaking API changes in future versions.`,name:"negative_prompt_ids"},{anchor:"transformers.Phi3ForCausalLM.generate.negative_prompt_attention_mask",description:`<strong>negative_prompt_attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Attention_mask for <code>negative_prompt_ids</code>.`,name:"negative_prompt_attention_mask"},{anchor:"transformers.Phi3ForCausalLM.generate.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Ad hoc parametrization of <code>generation_config</code> and/or additional model-specific kwargs that will be
forwarded to the <code>forward</code> function of the model. If the model is an encoder-decoder model, encoder
specific kwargs should not be prefixed and decoder specific kwargs should be prefixed with <em>decoder_</em>.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/generation/utils.py#L1584",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_31098/en/main_classes/output#transformers.utils.ModelOutput"
>ModelOutput</a> (if <code>return_dict_in_generate=True</code>
or when <code>config.return_dict_in_generate=True</code>) or a <code>torch.LongTensor</code>.</p>
<p>If the model is <em>not</em> an encoder-decoder model (<code>model.config.is_encoder_decoder=False</code>), the possible
<a
  href="/docs/transformers/pr_31098/en/main_classes/output#transformers.utils.ModelOutput"
>ModelOutput</a> types are:</p>
<ul>
<li><a
  href="/docs/transformers/pr_31098/en/internal/generation_utils#transformers.generation.GenerateDecoderOnlyOutput"
>GenerateDecoderOnlyOutput</a>,</li>
<li><a
  href="/docs/transformers/pr_31098/en/internal/generation_utils#transformers.generation.GenerateBeamDecoderOnlyOutput"
>GenerateBeamDecoderOnlyOutput</a></li>
</ul>
<p>If the model is an encoder-decoder model (<code>model.config.is_encoder_decoder=True</code>), the possible
<a
  href="/docs/transformers/pr_31098/en/main_classes/output#transformers.utils.ModelOutput"
>ModelOutput</a> types are:</p>
<ul>
<li><a
  href="/docs/transformers/pr_31098/en/internal/generation_utils#transformers.generation.GenerateEncoderDecoderOutput"
>GenerateEncoderDecoderOutput</a>,</li>
<li><a
  href="/docs/transformers/pr_31098/en/internal/generation_utils#transformers.generation.GenerateBeamEncoderDecoderOutput"
>GenerateBeamEncoderDecoderOutput</a></li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/pr_31098/en/main_classes/output#transformers.utils.ModelOutput"
>ModelOutput</a> or <code>torch.LongTensor</code></p>
`}}),R=new Qe({props:{warning:!0,$$slots:{default:[qt]},$$scope:{ctx:$}}}),V=new pe({props:{title:"Phi3ForSequenceClassification",local:"transformers.Phi3ForSequenceClassification",headingTag:"h2"}}),I=new ce({props:{name:"class transformers.Phi3ForSequenceClassification",anchor:"transformers.Phi3ForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Phi3ForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3Config">Phi3Config</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_31098/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_31098/src/transformers/models/phi3/modeling_phi3.py#L1356"}}),qe=new ce({props:{name:"forward",anchor:"transformers.Phi3ForSequenceClassification.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.Phi3ForSequenceClassification.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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.Phi3ForSequenceClassification.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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>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.Phi3ForSequenceClassification.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.Phi3ForSequenceClassification.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_31098/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.Phi3ForSequenceClassification.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.Phi3ForSequenceClassification.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.Phi3ForSequenceClassification.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.Phi3ForSequenceClassification.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.Phi3ForSequenceClassification.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_31098/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Phi3ForSequenceClassification.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.Phi3ForSequenceClassification.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_31098/src/transformers/models/phi3/modeling_phi3.py#L1388"}}),xe=new Qe({props:{$$slots:{default:[Wt]},$$scope:{ctx:$}}}),We=new pe({props:{title:"Phi3ForTokenClassification",local:"transformers.Phi3ForTokenClassification",headingTag:"h2"}}),Ne=new ce({props:{name:"class transformers.Phi3ForTokenClassification",anchor:"transformers.Phi3ForTokenClassification",parameters:[{name:"config",val:": Phi3Config"}],parametersDescription:[{anchor:"transformers.Phi3ForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3Config">Phi3Config</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_31098/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_31098/src/transformers/models/phi3/modeling_phi3.py#L1480"}}),Ge=new ce({props:{name:"forward",anchor:"transformers.Phi3ForTokenClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"past_key_values",val:": Optional = None"},{name:"attention_mask",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:"**deprecated_arguments",val:""}],parametersDescription:[{anchor:"transformers.Phi3ForTokenClassification.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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.Phi3ForTokenClassification.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_31098/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_31098/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_31098/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>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.Phi3ForTokenClassification.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.Phi3ForTokenClassification.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_31098/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.Phi3ForTokenClassification.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.Phi3ForTokenClassification.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.Phi3ForTokenClassification.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.Phi3ForTokenClassification.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.Phi3ForTokenClassification.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_31098/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Phi3ForTokenClassification.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.Phi3ForTokenClassification.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_31098/src/transformers/models/phi3/modeling_phi3.py#L1506",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/pr_31098/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</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_31098/en/model_doc/phi3#transformers.Phi3Config"
>Phi3Config</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)  — Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</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_31098/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ze=new Qe({props:{$$slots:{default:[Nt]},$$scope:{ctx:$}}}),je=new mt({props:{anchor:"transformers.Phi3ForTokenClassification.forward.example",$$slots:{default:[Gt]},$$scope:{ctx:$}}}),{c(){g(t.$$.fragment),u=i(),o=h("div"),g(r.$$.fragment),k=i(),s=h("p"),s.innerHTML=M,ke=i(),q=h("p"),q.innerHTML=Ae,we=i(),W=h("p"),W.innerHTML=Le,K=i(),B=h("div"),g(O.$$.fragment),ee=i(),he=h("p"),he.innerHTML=Ie,te=i(),g(ne.$$.fragment),me=i(),g(L.$$.fragment),ue=i(),z=h("div"),g(re.$$.fragment),Me=i(),x=h("div"),g(X.$$.fragment),E=i(),oe=h("p"),oe.innerHTML=ie,$e=i(),g(F.$$.fragment),Pe=i(),g(C.$$.fragment),se=i(),N=h("div"),g(G.$$.fragment),Je=i(),de=h("p"),de.textContent=fe,Be=i(),g(R.$$.fragment),Z=i(),g(V.$$.fragment),H=i(),P=h("div"),g(I.$$.fragment),Ce=i(),Q=h("p"),Q.innerHTML=Ue,e=i(),c=h("p"),c.innerHTML=J,Ze=i(),ge=h("p"),ge.innerHTML=ut,tt=i(),He=h("p"),He.innerHTML=ft,nt=i(),Se=h("p"),Se.innerHTML=gt,ot=i(),le=h("div"),g(qe.$$.fragment),st=i(),Oe=h("p"),Oe.innerHTML=_t,at=i(),g(xe.$$.fragment),De=i(),g(We.$$.fragment),Ye=i(),U=h("div"),g(Ne.$$.fragment),rt=i(),Xe=h("p"),Xe.innerHTML=bt,it=i(),Ee=h("p"),Ee.innerHTML=yt,dt=i(),Re=h("p"),Re.innerHTML=Tt,lt=i(),A=h("div"),g(Ge.$$.fragment),ct=i(),Ve=h("p"),Ve.innerHTML=vt,pt=i(),g(ze.$$.fragment),ht=i(),g(je.$$.fragment),this.h()},l(n){_(t.$$.fragment,n),u=d(n),o=m(n,"DIV",{class:!0});var f=D(o);_(r.$$.fragment,f),k=d(f),s=m(f,"P",{"data-svelte-h":!0}),w(s)!=="svelte-1h0prp0"&&(s.innerHTML=M),ke=d(f),q=m(f,"P",{"data-svelte-h":!0}),w(q)!=="svelte-hswkmf"&&(q.innerHTML=Ae),we=d(f),W=m(f,"P",{"data-svelte-h":!0}),w(W)!=="svelte-1njzjq3"&&(W.innerHTML=Le),K=d(f),B=m(f,"DIV",{class:!0});var _e=D(B);_(O.$$.fragment,_e),ee=d(_e),he=m(_e,"P",{"data-svelte-h":!0}),w(he)!=="svelte-1qvtf5c"&&(he.innerHTML=Ie),te=d(_e),_(ne.$$.fragment,_e),_e.forEach(a),f.forEach(a),me=d(n),_(L.$$.fragment,n),ue=d(n),z=m(n,"DIV",{class:!0});var be=D(z);_(re.$$.fragment,be),Me=d(be),x=m(be,"DIV",{class:!0});var ae=D(x);_(X.$$.fragment,ae),E=d(ae),oe=m(ae,"P",{"data-svelte-h":!0}),w(oe)!=="svelte-nlk7bg"&&(oe.innerHTML=ie),$e=d(ae),_(F.$$.fragment,ae),Pe=d(ae),_(C.$$.fragment,ae),ae.forEach(a),se=d(be),N=m(be,"DIV",{class:!0});var ye=D(N);_(G.$$.fragment,ye),Je=d(ye),de=m(ye,"P",{"data-svelte-h":!0}),w(de)!=="svelte-s5ko3x"&&(de.textContent=fe),Be=d(ye),_(R.$$.fragment,ye),ye.forEach(a),be.forEach(a),Z=d(n),_(V.$$.fragment,n),H=d(n),P=m(n,"DIV",{class:!0});var j=D(P);_(I.$$.fragment,j),Ce=d(j),Q=m(j,"P",{"data-svelte-h":!0}),w(Q)!=="svelte-1misj5a"&&(Q.innerHTML=Ue),e=d(j),c=m(j,"P",{"data-svelte-h":!0}),w(c)!=="svelte-xzmnxd"&&(c.innerHTML=J),Ze=d(j),ge=m(j,"P",{"data-svelte-h":!0}),w(ge)!=="svelte-10ugs3m"&&(ge.innerHTML=ut),tt=d(j),He=m(j,"P",{"data-svelte-h":!0}),w(He)!=="svelte-1b312h9"&&(He.innerHTML=ft),nt=d(j),Se=m(j,"P",{"data-svelte-h":!0}),w(Se)!=="svelte-hswkmf"&&(Se.innerHTML=gt),ot=d(j),le=m(j,"DIV",{class:!0});var Te=D(le);_(qe.$$.fragment,Te),st=d(Te),Oe=m(Te,"P",{"data-svelte-h":!0}),w(Oe)!=="svelte-6pb5yc"&&(Oe.innerHTML=_t),at=d(Te),_(xe.$$.fragment,Te),Te.forEach(a),j.forEach(a),De=d(n),_(We.$$.fragment,n),Ye=d(n),U=m(n,"DIV",{class:!0});var S=D(U);_(Ne.$$.fragment,S),rt=d(S),Xe=m(S,"P",{"data-svelte-h":!0}),w(Xe)!=="svelte-obpocu"&&(Xe.innerHTML=bt),it=d(S),Ee=m(S,"P",{"data-svelte-h":!0}),w(Ee)!=="svelte-1b312h9"&&(Ee.innerHTML=yt),dt=d(S),Re=m(S,"P",{"data-svelte-h":!0}),w(Re)!=="svelte-hswkmf"&&(Re.innerHTML=Tt),lt=d(S),A=m(S,"DIV",{class:!0});var Fe=D(A);_(Ge.$$.fragment,Fe),ct=d(Fe),Ve=m(Fe,"P",{"data-svelte-h":!0}),w(Ve)!=="svelte-1yeiimc"&&(Ve.innerHTML=vt),pt=d(Fe),_(ze.$$.fragment,Fe),ht=d(Fe),_(je.$$.fragment,Fe),Fe.forEach(a),S.forEach(a),this.h()},h(){Y(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(o,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Y(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(n,f){b(t,n,f),p(n,u,f),p(n,o,f),b(r,o,null),l(o,k),l(o,s),l(o,ke),l(o,q),l(o,we),l(o,W),l(o,K),l(o,B),b(O,B,null),l(B,ee),l(B,he),l(B,te),b(ne,B,null),p(n,me,f),b(L,n,f),p(n,ue,f),p(n,z,f),b(re,z,null),l(z,Me),l(z,x),b(X,x,null),l(x,E),l(x,oe),l(x,$e),b(F,x,null),l(x,Pe),b(C,x,null),l(z,se),l(z,N),b(G,N,null),l(N,Je),l(N,de),l(N,Be),b(R,N,null),p(n,Z,f),b(V,n,f),p(n,H,f),p(n,P,f),b(I,P,null),l(P,Ce),l(P,Q),l(P,e),l(P,c),l(P,Ze),l(P,ge),l(P,tt),l(P,He),l(P,nt),l(P,Se),l(P,ot),l(P,le),b(qe,le,null),l(le,st),l(le,Oe),l(le,at),b(xe,le,null),p(n,De,f),b(We,n,f),p(n,Ye,f),p(n,U,f),b(Ne,U,null),l(U,rt),l(U,Xe),l(U,it),l(U,Ee),l(U,dt),l(U,Re),l(U,lt),l(U,A),b(Ge,A,null),l(A,ct),l(A,Ve),l(A,pt),b(ze,A,null),l(A,ht),b(je,A,null),Ke=!0},p(n,f){const _e={};f&2&&(_e.$$scope={dirty:f,ctx:n}),ne.$set(_e);const be={};f&2&&(be.$$scope={dirty:f,ctx:n}),F.$set(be);const ae={};f&2&&(ae.$$scope={dirty:f,ctx:n}),C.$set(ae);const ye={};f&2&&(ye.$$scope={dirty:f,ctx:n}),R.$set(ye);const j={};f&2&&(j.$$scope={dirty:f,ctx:n}),xe.$set(j);const Te={};f&2&&(Te.$$scope={dirty:f,ctx:n}),ze.$set(Te);const S={};f&2&&(S.$$scope={dirty:f,ctx:n}),je.$set(S)},i(n){Ke||(y(t.$$.fragment,n),y(r.$$.fragment,n),y(O.$$.fragment,n),y(ne.$$.fragment,n),y(L.$$.fragment,n),y(re.$$.fragment,n),y(X.$$.fragment,n),y(F.$$.fragment,n),y(C.$$.fragment,n),y(G.$$.fragment,n),y(R.$$.fragment,n),y(V.$$.fragment,n),y(I.$$.fragment,n),y(qe.$$.fragment,n),y(xe.$$.fragment,n),y(We.$$.fragment,n),y(Ne.$$.fragment,n),y(Ge.$$.fragment,n),y(ze.$$.fragment,n),y(je.$$.fragment,n),Ke=!0)},o(n){T(t.$$.fragment,n),T(r.$$.fragment,n),T(O.$$.fragment,n),T(ne.$$.fragment,n),T(L.$$.fragment,n),T(re.$$.fragment,n),T(X.$$.fragment,n),T(F.$$.fragment,n),T(C.$$.fragment,n),T(G.$$.fragment,n),T(R.$$.fragment,n),T(V.$$.fragment,n),T(I.$$.fragment,n),T(qe.$$.fragment,n),T(xe.$$.fragment,n),T(We.$$.fragment,n),T(Ne.$$.fragment,n),T(Ge.$$.fragment,n),T(ze.$$.fragment,n),T(je.$$.fragment,n),Ke=!1},d(n){n&&(a(u),a(o),a(me),a(ue),a(z),a(Z),a(H),a(P),a(De),a(Ye),a(U)),v(t,n),v(r),v(O),v(ne),v(L,n),v(re),v(X),v(F),v(C),v(G),v(R),v(V,n),v(I),v(qe),v(xe),v(We,n),v(Ne),v(Ge),v(ze),v(je)}}}function Bt($){let t,u;return t=new xt({props:{$$slots:{default:[Jt]},$$scope:{ctx:$}}}),{c(){g(t.$$.fragment)},l(o){_(t.$$.fragment,o)},m(o,r){b(t,o,r),u=!0},p(o,r){const k={};r&2&&(k.$$scope={dirty:r,ctx:o}),t.$set(k)},i(o){u||(y(t.$$.fragment,o),u=!0)},o(o){T(t.$$.fragment,o),u=!1},d(o){v(t,o)}}}function Zt($){let t,u,o,r,k,s,M,ke,q,Ae='The Phi-3 model was proposed in <a href="https://arxiv.org/abs/2404.14219" rel="nofollow">Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone</a> by Microsoft.',we,W,Le,K,B="The abstract from the Phi-3 paper is the following:",O,ee,he="We introduce phi-3-mini, a 3.8 billion parameter language model trained on 3.3 trillion tokens, whose overall performance, as measured by both academic benchmarks and internal testing, rivals that of models such as Mixtral 8x7B and GPT-3.5 (e.g., phi-3-mini achieves 69% on MMLU and 8.38 on MT-bench), despite being small enough to be deployed on a phone. The innovation lies entirely in our dataset for training, a scaled-up version of the one used for phi-2, composed of heavily filtered web data and synthetic data. The model is also further aligned for robustness, safety, and chat format. We also provide some initial parameter-scaling results with a 7B and 14B models trained for 4.8T tokens, called phi-3-small and phi-3-medium, both significantly more capable than phi-3-mini (e.g., respectively 75% and 78% on MMLU, and 8.7 and 8.9 on MT-bench).",Ie,te,ne='The original code for Phi-3 can be found <a href="https://huggingface.co/microsoft/Phi-3-mini-4k-instruct" rel="nofollow">here</a>.',me,L,ue,z,re='<li>This model is very similar to <code>Llama</code> with the main difference of <code>Phi3SuScaledRotaryEmbedding</code> and <code>Phi3YarnScaledRotaryEmbedding</code>, where they are used to extend the context of the rotary embeddings. The query, key and values are fused, and the MLP’s up and gate projection layers are also fused.</li> <li>The tokenizer used for this model is identical to the <a href="/docs/transformers/pr_31098/en/model_doc/llama#transformers.LlamaTokenizer">LlamaTokenizer</a>, with the exception of additional tokens.</li>',Me,x,X,E,oe,ie,$e,F,Pe,C,se,N,G,Je=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_31098/en/model_doc/phi3#transformers.Phi3Model">Phi3Model</a>. It is used to instantiate a Phi-3
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/microsoft/Phi-3-mini-4k-instruct" rel="nofollow">microsoft/Phi-3-mini-4k-instruct</a>.`,de,fe,Be=`Configuration objects inherit from <a href="/docs/transformers/pr_31098/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_31098/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,R,Z,V,H,P,I,Ce,Q,Ue;return k=new pe({props:{title:"Phi-3",local:"phi-3",headingTag:"h1"}}),M=new pe({props:{title:"Overview",local:"overview",headingTag:"h2"}}),W=new pe({props:{title:"Summary",local:"summary",headingTag:"h3"}}),L=new pe({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),x=new pe({props:{title:"How to use Phi-3",local:"how-to-use-phi-3",headingTag:"h2"}}),E=new Qe({props:{warning:!0,$$slots:{default:[jt]},$$scope:{ctx:$}}}),ie=new et({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRlBoaS0zLW1pbmktNGstaW5zdHJ1Y3QlMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGUGhpLTMtbWluaS00ay1pbnN0cnVjdCUyMiklMEElMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMCUyMkNhbiUyMHlvdSUyMHByb3ZpZGUlMjB3YXlzJTIwdG8lMjBlYXQlMjBjb21iaW5hdGlvbnMlMjBvZiUyMGJhbmFuYXMlMjBhbmQlMjBkcmFnb25mcnVpdHMlM0YlMjIlN0QlNUQlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIuYXBwbHlfY2hhdF90ZW1wbGF0ZShtZXNzYWdlcyUyQyUyMGFkZF9nZW5lcmF0aW9uX3Byb21wdCUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDMyKSUwQXRleHQlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKG91dHB1dHMpJTVCMCU1RCUwQXByaW50KHRleHQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;microsoft/Phi-3-mini-4k-instruct&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;microsoft/Phi-3-mini-4k-instruct&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>messages = [{<span class="hljs-string">&quot;role&quot;</span>: <span class="hljs-string">&quot;user&quot;</span>, <span class="hljs-string">&quot;content&quot;</span>: <span class="hljs-string">&quot;Can you provide ways to eat combinations of bananas and dragonfruits?&quot;</span>}]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">32</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>text = tokenizer.batch_decode(outputs)[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(text)
&lt;s&gt;&lt;|user|&gt; 
Can you provide ways to eat combinations of bananas <span class="hljs-keyword">and</span> dragonfruits?&lt;|end|&gt; 
&lt;|assistant|&gt; 
Certainly! Bananas <span class="hljs-keyword">and</span> dragonfruits can be combined <span class="hljs-keyword">in</span> various delicious ways. Here are some ideas <span class="hljs-keyword">for</span> eating combinations of bananas <span class="hljs-keyword">and</span>`,wrap:!1}}),F=new pe({props:{title:"Phi3Config",local:"transformers.Phi3Config",headingTag:"h2"}}),se=new ce({props:{name:"class transformers.Phi3Config",anchor:"transformers.Phi3Config",parameters:[{name:"vocab_size",val:" = 32064"},{name:"hidden_size",val:" = 3072"},{name:"intermediate_size",val:" = 8192"},{name:"num_hidden_layers",val:" = 32"},{name:"num_attention_heads",val:" = 32"},{name:"num_key_value_heads",val:" = None"},{name:"resid_pdrop",val:" = 0.0"},{name:"embd_pdrop",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"hidden_act",val:" = 'silu'"},{name:"max_position_embeddings",val:" = 4096"},{name:"original_max_position_embeddings",val:" = 4096"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1e-05"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 10000.0"},{name:"rope_scaling",val:" = None"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 32000"},{name:"pad_token_id",val:" = 32000"},{name:"sliding_window",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Phi3Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32064) &#x2014;
Vocabulary size of the Phi-3 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_31098/en/model_doc/phi3#transformers.Phi3Model">Phi3Model</a>.`,name:"vocab_size"},{anchor:"transformers.Phi3Config.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.Phi3Config.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8192) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.Phi3Config.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.Phi3Config.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 decoder.`,name:"num_attention_heads"},{anchor:"transformers.Phi3Config.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>) &#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.Phi3Config.resid_pdrop",description:`<strong>resid_pdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Dropout probability for mlp outputs.`,name:"resid_pdrop"},{anchor:"transformers.Phi3Config.embd_pdrop",description:`<strong>embd_pdrop</strong> (<code>int</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the embeddings.`,name:"embd_pdrop"},{anchor:"transformers.Phi3Config.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio after computing the attention scores.`,name:"attention_dropout"},{anchor:"transformers.Phi3Config.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) in the decoder.`,name:"hidden_act"},{anchor:"transformers.Phi3Config.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.`,name:"max_position_embeddings"},{anchor:"transformers.Phi3Config.original_max_position_embeddings",description:`<strong>original_max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
The maximum sequence length that this model was trained with. This is used to determine the size of the
original RoPE embeddings when using long scaling.`,name:"original_max_position_embeddings"},{anchor:"transformers.Phi3Config.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.Phi3Config.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon value used for the RMSNorm.`,name:"rms_norm_eps"},{anchor:"transformers.Phi3Config.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>. Whether to tie weight embeddings or not.`,name:"use_cache"},{anchor:"transformers.Phi3Config.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie weight embeddings`,name:"tie_word_embeddings"},{anchor:"transformers.Phi3Config.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, <em>optional</em>, defaults to 10000.0) &#x2014;
The base period of the RoPE embeddings.`,name:"rope_theta"},{anchor:"transformers.Phi3Config.rope_scaling",description:`<strong>rope_scaling</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
The scaling strategy for the RoPE embeddings. If <code>None</code>, no scaling is applied. If a dictionary, it must
contain the following keys: <code>type</code>, <code>short_factor</code> and <code>long_factor</code>. The <code>type</code> must be <code>longrope</code> and
the <code>short_factor</code> and <code>long_factor</code> must be lists of numbers with the same length as the hidden size
divided by the number of attention heads divided by 2.`,name:"rope_scaling"},{anchor:"transformers.Phi3Config.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The id of the &#x201C;beginning-of-sequence&#x201D; token.`,name:"bos_token_id"},{anchor:"transformers.Phi3Config.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 32000) &#x2014;
The id of the &#x201C;end-of-sequence&#x201D; token.`,name:"eos_token_id"},{anchor:"transformers.Phi3Config.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 32000) &#x2014;
The id of the padding token.`,name:"pad_token_id"},{anchor:"transformers.Phi3Config.sliding_window",description:`<strong>sliding_window</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Sliding window attention window size. If <code>None</code>, no sliding window is applied.`,name:"sliding_window"}],source:"https://github.com/huggingface/transformers/blob/vr_31098/src/transformers/models/phi3/configuration_phi3.py#L25"}}),Z=new mt({props:{anchor:"transformers.Phi3Config.example",$$slots:{default:[Ft]},$$scope:{ctx:$}}}),H=new Ct({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[Bt]},$$scope:{ctx:$}}}),I=new zt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/phi3.md"}}),{c(){t=h("meta"),u=i(),o=h("p"),r=i(),g(k.$$.fragment),s=i(),g(M.$$.fragment),ke=i(),q=h("p"),q.innerHTML=Ae,we=i(),g(W.$$.fragment),Le=i(),K=h("p"),K.textContent=B,O=i(),ee=h("p"),ee.textContent=he,Ie=i(),te=h("p"),te.innerHTML=ne,me=i(),g(L.$$.fragment),ue=i(),z=h("ul"),z.innerHTML=re,Me=i(),g(x.$$.fragment),X=i(),g(E.$$.fragment),oe=i(),g(ie.$$.fragment),$e=i(),g(F.$$.fragment),Pe=i(),C=h("div"),g(se.$$.fragment),N=i(),G=h("p"),G.innerHTML=Je,de=i(),fe=h("p"),fe.innerHTML=Be,R=i(),g(Z.$$.fragment),V=i(),g(H.$$.fragment),P=i(),g(I.$$.fragment),Ce=i(),Q=h("p"),this.h()},l(e){const c=Pt("svelte-u9bgzb",document.head);t=m(c,"META",{name:!0,content:!0}),c.forEach(a),u=d(e),o=m(e,"P",{}),D(o).forEach(a),r=d(e),_(k.$$.fragment,e),s=d(e),_(M.$$.fragment,e),ke=d(e),q=m(e,"P",{"data-svelte-h":!0}),w(q)!=="svelte-1d28kuk"&&(q.innerHTML=Ae),we=d(e),_(W.$$.fragment,e),Le=d(e),K=m(e,"P",{"data-svelte-h":!0}),w(K)!=="svelte-1iah8ch"&&(K.textContent=B),O=d(e),ee=m(e,"P",{"data-svelte-h":!0}),w(ee)!=="svelte-10zying"&&(ee.textContent=he),Ie=d(e),te=m(e,"P",{"data-svelte-h":!0}),w(te)!=="svelte-1deox1y"&&(te.innerHTML=ne),me=d(e),_(L.$$.fragment,e),ue=d(e),z=m(e,"UL",{"data-svelte-h":!0}),w(z)!=="svelte-1dymda8"&&(z.innerHTML=re),Me=d(e),_(x.$$.fragment,e),X=d(e),_(E.$$.fragment,e),oe=d(e),_(ie.$$.fragment,e),$e=d(e),_(F.$$.fragment,e),Pe=d(e),C=m(e,"DIV",{class:!0});var J=D(C);_(se.$$.fragment,J),N=d(J),G=m(J,"P",{"data-svelte-h":!0}),w(G)!=="svelte-125js98"&&(G.innerHTML=Je),de=d(J),fe=m(J,"P",{"data-svelte-h":!0}),w(fe)!=="svelte-1eopo2z"&&(fe.innerHTML=Be),R=d(J),_(Z.$$.fragment,J),J.forEach(a),V=d(e),_(H.$$.fragment,e),P=d(e),_(I.$$.fragment,e),Ce=d(e),Q=m(e,"P",{}),D(Q).forEach(a),this.h()},h(){Y(t,"name","hf:doc:metadata"),Y(t,"content",Ht),Y(C,"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,c){l(document.head,t),p(e,u,c),p(e,o,c),p(e,r,c),b(k,e,c),p(e,s,c),b(M,e,c),p(e,ke,c),p(e,q,c),p(e,we,c),b(W,e,c),p(e,Le,c),p(e,K,c),p(e,O,c),p(e,ee,c),p(e,Ie,c),p(e,te,c),p(e,me,c),b(L,e,c),p(e,ue,c),p(e,z,c),p(e,Me,c),b(x,e,c),p(e,X,c),b(E,e,c),p(e,oe,c),b(ie,e,c),p(e,$e,c),b(F,e,c),p(e,Pe,c),p(e,C,c),b(se,C,null),l(C,N),l(C,G),l(C,de),l(C,fe),l(C,R),b(Z,C,null),p(e,V,c),b(H,e,c),p(e,P,c),b(I,e,c),p(e,Ce,c),p(e,Q,c),Ue=!0},p(e,[c]){const J={};c&2&&(J.$$scope={dirty:c,ctx:e}),E.$set(J);const Ze={};c&2&&(Ze.$$scope={dirty:c,ctx:e}),Z.$set(Ze);const ge={};c&2&&(ge.$$scope={dirty:c,ctx:e}),H.$set(ge)},i(e){Ue||(y(k.$$.fragment,e),y(M.$$.fragment,e),y(W.$$.fragment,e),y(L.$$.fragment,e),y(x.$$.fragment,e),y(E.$$.fragment,e),y(ie.$$.fragment,e),y(F.$$.fragment,e),y(se.$$.fragment,e),y(Z.$$.fragment,e),y(H.$$.fragment,e),y(I.$$.fragment,e),Ue=!0)},o(e){T(k.$$.fragment,e),T(M.$$.fragment,e),T(W.$$.fragment,e),T(L.$$.fragment,e),T(x.$$.fragment,e),T(E.$$.fragment,e),T(ie.$$.fragment,e),T(F.$$.fragment,e),T(se.$$.fragment,e),T(Z.$$.fragment,e),T(H.$$.fragment,e),T(I.$$.fragment,e),Ue=!1},d(e){e&&(a(u),a(o),a(r),a(s),a(ke),a(q),a(we),a(Le),a(K),a(O),a(ee),a(Ie),a(te),a(me),a(ue),a(z),a(Me),a(X),a(oe),a($e),a(Pe),a(C),a(V),a(P),a(Ce),a(Q)),a(t),v(k,e),v(M,e),v(W,e),v(L,e),v(x,e),v(E,e),v(ie,e),v(F,e),v(se),v(Z),v(H,e),v(I,e)}}}const Ht='{"title":"Phi-3","local":"phi-3","sections":[{"title":"Overview","local":"overview","sections":[{"title":"Summary","local":"summary","sections":[],"depth":3}],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"How to use Phi-3","local":"how-to-use-phi-3","sections":[],"depth":2},{"title":"Phi3Config","local":"transformers.Phi3Config","sections":[],"depth":2},{"title":"Phi3Model","local":"transformers.Phi3Model","sections":[],"depth":2},{"title":"Phi3ForCausalLM","local":"transformers.Phi3ForCausalLM","sections":[],"depth":2},{"title":"Phi3ForSequenceClassification","local":"transformers.Phi3ForSequenceClassification","sections":[],"depth":2},{"title":"Phi3ForTokenClassification","local":"transformers.Phi3ForTokenClassification","sections":[],"depth":2}],"depth":1}';function St($){return wt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Yt extends Mt{constructor(t){super(),$t(this,t,St,Zt,kt,{})}}export{Yt as component};
