import{s as kn,o as yn,n as ye}from"../chunks/scheduler.9bc65507.js";import{S as vn,i as Tn,g as c,s as a,r as h,m as wn,A as Mn,h as m,f as o,c as r,j as I,u,x as b,n as bn,k as Z,y as s,a as d,v as f,d as g,t as _,w}from"../chunks/index.707bf1b6.js";import{T as Xt}from"../chunks/Tip.c2ecdbf4.js";import{D as V}from"../chunks/Docstring.17db21ae.js";import{C as Xe}from"../chunks/CodeBlock.54a9f38d.js";import{E as ut}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as L}from"../chunks/Heading.342b1fa6.js";function $n(z){let t,k;return t=new Xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yTW9kZWwlMkMlMjBRd2VuMkNvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBRd2VuMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBRd2VuMkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMFF3ZW4yLTdCJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBRd2VuMk1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2Model, Qwen2Config

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Qwen2 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Qwen2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the Qwen2-7B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Qwen2Model(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(){h(t.$$.fragment)},l(l){u(t.$$.fragment,l)},m(l,p){f(t,l,p),k=!0},p:ye,i(l){k||(g(t.$$.fragment,l),k=!0)},o(l){_(t.$$.fragment,l),k=!1},d(l){w(t,l)}}}function zn(z){let t,k="be encoded differently whether it is at the beginning of the sentence (without space) or not:",l,p,y;return p=new Xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yVG9rZW5pemVyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwUXdlbjJUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMlF3ZW4lMkZRd2VuLXRva2VuaXplciUyMiklMEF0b2tlbml6ZXIoJTIySGVsbG8lMjB3b3JsZCUyMiklNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMEF0b2tlbml6ZXIoJTIyJTIwSGVsbG8lMjB3b3JsZCUyMiklNUIlMjJpbnB1dF9pZHMlMjIlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2Tokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = Qwen2Tokenizer.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen-tokenizer&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">9707</span>, <span class="hljs-number">1879</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">21927</span>, <span class="hljs-number">1879</span>]`,wrap:!1}}),{c(){t=c("p"),t.textContent=k,l=a(),h(p.$$.fragment)},l(i){t=m(i,"P",{"data-svelte-h":!0}),b(t)!=="svelte-12atnao"&&(t.textContent=k),l=r(i),u(p.$$.fragment,i)},m(i,v){d(i,t,v),d(i,l,v),f(p,i,v),y=!0},p:ye,i(i){y||(g(p.$$.fragment,i),y=!0)},o(i){_(p.$$.fragment,i),y=!1},d(i){i&&(o(t),o(l)),w(p,i)}}}function Qn(z){let t,k="be encoded differently whether it is at the beginning of the sentence (without space) or not:",l,p,y;return p=new Xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFF3ZW4yVG9rZW5pemVyRmFzdCUwQSUwQXRva2VuaXplciUyMCUzRCUyMFF3ZW4yVG9rZW5pemVyRmFzdC5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4tdG9rZW5pemVyJTIyKSUwQXRva2VuaXplciglMjJIZWxsbyUyMHdvcmxkJTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQSUwQXRva2VuaXplciglMjIlMjBIZWxsbyUyMHdvcmxkJTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Qwen2TokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = Qwen2TokenizerFast.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen-tokenizer&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot;Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">9707</span>, <span class="hljs-number">1879</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer(<span class="hljs-string">&quot; Hello world&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
[<span class="hljs-number">21927</span>, <span class="hljs-number">1879</span>]`,wrap:!1}}),{c(){t=c("p"),t.textContent=k,l=a(),h(p.$$.fragment)},l(i){t=m(i,"P",{"data-svelte-h":!0}),b(t)!=="svelte-12atnao"&&(t.textContent=k),l=r(i),u(p.$$.fragment,i)},m(i,v){d(i,t,v),d(i,l,v),f(p,i,v),y=!0},p:ye,i(i){y||(g(p.$$.fragment,i),y=!0)},o(i){_(p.$$.fragment,i),y=!1},d(i){i&&(o(t),o(l)),w(p,i)}}}function xn(z){let t,k=`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=c("p"),t.innerHTML=k},l(l){t=m(l,"P",{"data-svelte-h":!0}),b(t)!=="svelte-fincs2"&&(t.innerHTML=k)},m(l,p){d(l,t,p)},p:ye,d(l){l&&o(t)}}}function Cn(z){let t,k=`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=c("p"),t.innerHTML=k},l(l){t=m(l,"P",{"data-svelte-h":!0}),b(t)!=="svelte-fincs2"&&(t.innerHTML=k)},m(l,p){d(l,t,p)},p:ye,d(l){l&&o(t)}}}function jn(z){let t,k="Example:",l,p,y;return p=new Xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRd2VuMkZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBRd2VuMkZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChQQVRIX1RPX0NPTlZFUlRFRF9XRUlHSFRTKSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKFBBVEhfVE9fQ09OVkVSVEVEX1RPS0VOSVpFUiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJIZXklMkMlMjBhcmUlMjB5b3UlMjBjb25zY2lvdXMlM0YlMjBDYW4lMjB5b3UlMjB0YWxrJTIwdG8lMjBtZSUzRiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMEdlbmVyYXRlJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzLmlucHV0X2lkcyUyQyUyMG1heF9sZW5ndGglM0QzMCklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTIwY2xlYW5fdXBfdG9rZW5pemF0aW9uX3NwYWNlcyUzREZhbHNlKSU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, Qwen2ForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = Qwen2ForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Hey, are you conscious? Can you talk to me?&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">&quot;Hey, are you conscious? Can you talk to me?\\nI&#x27;m not conscious, but I can talk to you.&quot;</span>`,wrap:!1}}),{c(){t=c("p"),t.textContent=k,l=a(),h(p.$$.fragment)},l(i){t=m(i,"P",{"data-svelte-h":!0}),b(t)!=="svelte-11lpom8"&&(t.textContent=k),l=r(i),u(p.$$.fragment,i)},m(i,v){d(i,t,v),d(i,l,v),f(p,i,v),y=!0},p:ye,i(i){y||(g(p.$$.fragment,i),y=!0)},o(i){_(p.$$.fragment,i),y=!1},d(i){i&&(o(t),o(l)),w(p,i)}}}function Fn(z){let t,k=`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=c("p"),t.innerHTML=k},l(l){t=m(l,"P",{"data-svelte-h":!0}),b(t)!=="svelte-fincs2"&&(t.innerHTML=k)},m(l,p){d(l,t,p)},p:ye,d(l){l&&o(t)}}}function qn(z){let t,k,l,p,y,i,v,Ge,D,Gt="Qwen2 is the new model series of large language models from the Qwen team. Previously, we released the Qwen series, including Qwen-72B, Qwen-1.8B, Qwen-VL, Qwen-Audio, etc.",Ee,Y,Ae,K,Et="Qwen2 is a language model series including decoder language models of different model sizes. For each size, we release the base language model and the aligned chat model. It is based on the Transformer architecture with SwiGLU activation, attention QKV bias, group query attention, mixture of sliding window attention and full attention, etc. Additionally, we have an improved tokenizer adaptive to multiple natural languages and codes.",Oe,ee,De,te,At='<code>Qwen2-7B-beta</code> and <code>Qwen2-7B-Chat-beta</code> can be found on the <a href="https://huggingface.co/Qwen" rel="nofollow">Huggingface Hub</a>',Ye,ne,Ot="In the following, we demonstrate how to use <code>Qwen2-7B-Chat-beta</code> for the inference. Note that we have used the ChatML format for dialog, in this demo we show how to leverage <code>apply_chat_template</code> for this purpose.",Ke,oe,et,se,tt,j,ae,ft,ve,Dt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2Model">Qwen2Model</a>. It is used to instantiate a
Qwen2 model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of
Qwen2-7B-beta <a href="https://huggingface.co/Qwen/Qwen2-7B-beta" rel="nofollow">Qwen/Qwen2-7B-beta</a>.`,gt,Te,Yt=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,_t,S,nt,re,ot,T,ie,wt,Me,Kt="Construct a Qwen2 tokenizer. Based on byte-level Byte-Pair-Encoding.",bt,$e,en="Same with GPT2Tokenizer, this tokenizer has been trained to treat spaces like parts of the tokens so a word will",kt,B,yt,ze,tn="You should not use GPT2Tokenizer instead, because of the different pretokenization rules.",vt,Qe,nn=`This tokenizer inherits from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,Tt,xe,le,st,de,at,Q,ce,Mt,Ce,on=`Construct a “fast” Qwen2 tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on byte-level
Byte-Pair-Encoding.`,$t,je,sn="Same with GPT2Tokenizer, this tokenizer has been trained to treat spaces like parts of the tokens so a word will",zt,N,Qt,Fe,an=`This tokenizer inherits from <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,rt,me,it,x,pe,xt,qe,rn=`The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Ct,Ue,ln=`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.`,jt,Ie,dn="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>Qwen2DecoderLayer</code>",Ft,P,he,qt,Ze,cn='The <a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2Model">Qwen2Model</a> forward method, overrides the <code>__call__</code> special method.',Ut,X,lt,ue,dt,R,fe,It,U,ge,Zt,We,mn='The <a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2ForCausalLM">Qwen2ForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',Wt,G,Pt,E,ct,_e,mt,M,we,Jt,Pe,pn="The Qwen2 Model transformer with a sequence classification head on top (linear layer).",Vt,Je,hn=`<a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2ForSequenceClassification">Qwen2ForSequenceClassification</a> uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`,Lt,Ve,un=`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).`,Rt,Le,fn=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Ht,Re,gn=`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,J,be,Bt,He,_n='The <a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2ForSequenceClassification">Qwen2ForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Nt,A,pt,Be,ht;return y=new L({props:{title:"Qwen2",local:"qwen2",headingTag:"h1"}}),v=new L({props:{title:"Overview",local:"overview",headingTag:"h2"}}),Y=new L({props:{title:"Model Details",local:"model-details",headingTag:"h3"}}),ee=new L({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),oe=new Xe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjAlMjMlMjB0aGUlMjBkZXZpY2UlMjB0byUyMGxvYWQlMjB0aGUlMjBtb2RlbCUyMG9udG8lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJRd2VuJTJGUXdlbjEuNS03Qi1DaGF0JTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyUXdlbiUyRlF3ZW4xLjUtN0ItQ2hhdCUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJHaXZlJTIwbWUlMjBhJTIwc2hvcnQlMjBpbnRyb2R1Y3Rpb24lMjB0byUyMGxhcmdlJTIwbGFuZ3VhZ2UlMjBtb2RlbC4lMjIlMEElMEFtZXNzYWdlcyUyMCUzRCUyMCU1QiU3QiUyMnJvbGUlMjIlM0ElMjAlMjJ1c2VyJTIyJTJDJTIwJTIyY29udGVudCUyMiUzQSUyMHByb21wdCU3RCU1RCUwQSUwQXRleHQlMjAlM0QlMjB0b2tlbml6ZXIuYXBwbHlfY2hhdF90ZW1wbGF0ZShtZXNzYWdlcyUyQyUyMHRva2VuaXplJTNERmFsc2UlMkMlMjBhZGRfZ2VuZXJhdGlvbl9wcm9tcHQlM0RUcnVlKSUwQSUwQW1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplciglNUJ0ZXh0JTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlKSUwQSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShtb2RlbF9pbnB1dHMuaW5wdXRfaWRzJTJDJTIwbWF4X25ld190b2tlbnMlM0Q1MTIlMkMlMjBkb19zYW1wbGUlM0RUcnVlKSUwQSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjAlNUJvdXRwdXRfaWRzJTVCbGVuKGlucHV0X2lkcyklM0ElNUQlMjBmb3IlMjBpbnB1dF9pZHMlMkMlMjBvdXRwdXRfaWRzJTIwaW4lMjB6aXAobW9kZWxfaW5wdXRzLmlucHV0X2lkcyUyQyUyMGdlbmVyYXRlZF9pZHMpJTVEJTBBJTBBcmVzcG9uc2UlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVE",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>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>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen1.5-7B-Chat&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Qwen/Qwen1.5-7B-Chat&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Give me a short introduction to large language model.&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>: prompt}]

<span class="hljs-meta">&gt;&gt;&gt; </span>text = tokenizer.apply_chat_template(messages, tokenize=<span class="hljs-literal">False</span>, add_generation_prompt=<span class="hljs-literal">True</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>model_inputs = tokenizer([text], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=<span class="hljs-number">512</span>, do_sample=<span class="hljs-literal">True</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = [output_ids[<span class="hljs-built_in">len</span>(input_ids):] <span class="hljs-keyword">for</span> input_ids, output_ids <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(model_inputs.input_ids, generated_ids)]

<span class="hljs-meta">&gt;&gt;&gt; </span>response = tokenizer.batch_decode(generated_ids, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]`,wrap:!1}}),se=new L({props:{title:"Qwen2Config",local:"transformers.Qwen2Config",headingTag:"h2"}}),ae=new V({props:{name:"class transformers.Qwen2Config",anchor:"transformers.Qwen2Config",parameters:[{name:"vocab_size",val:" = 151936"},{name:"hidden_size",val:" = 4096"},{name:"intermediate_size",val:" = 22016"},{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:" = 32768"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1e-06"},{name:"use_cache",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 10000.0"},{name:"use_sliding_window",val:" = False"},{name:"sliding_window",val:" = 4096"},{name:"max_window_layers",val:" = 28"},{name:"attention_dropout",val:" = 0.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 151936) &#x2014;
Vocabulary size of the Qwen2 model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2Model">Qwen2Model</a>`,name:"vocab_size"},{anchor:"transformers.Qwen2Config.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.Qwen2Config.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 22016) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.Qwen2Config.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 encoder.`,name:"num_hidden_layers"},{anchor:"transformers.Qwen2Config.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.Qwen2Config.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 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 [this paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to </code>32\`.`,name:"num_key_value_heads"},{anchor:"transformers.Qwen2Config.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.Qwen2Config.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 32768) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.Qwen2Config.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.Qwen2Config.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.Qwen2Config.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.Qwen2Config.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.Qwen2Config.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.Qwen2Config.use_sliding_window",description:`<strong>use_sliding_window</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use sliding window attention.`,name:"use_sliding_window"},{anchor:"transformers.Qwen2Config.sliding_window",description:`<strong>sliding_window</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Sliding window attention (SWA) window size. If not specified, will default to <code>4096</code>.`,name:"sliding_window"},{anchor:"transformers.Qwen2Config.max_window_layers",description:`<strong>max_window_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 28) &#x2014;
The number of layers that use SWA (Sliding Window Attention). The bottom layers use SWA while the top use full attention.`,name:"max_window_layers"},{anchor:"transformers.Qwen2Config.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/configuration_qwen2.py#L27"}}),S=new ut({props:{anchor:"transformers.Qwen2Config.example",$$slots:{default:[$n]},$$scope:{ctx:z}}}),re=new L({props:{title:"Qwen2Tokenizer",local:"transformers.Qwen2Tokenizer",headingTag:"h2"}}),ie=new V({props:{name:"class transformers.Qwen2Tokenizer",anchor:"transformers.Qwen2Tokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"errors",val:" = 'replace'"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = None"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"pad_token",val:" = '<|endoftext|>'"},{name:"clean_up_tokenization_spaces",val:" = False"},{name:"split_special_tokens",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2Tokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.Qwen2Tokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.Qwen2Tokenizer.errors",description:`<strong>errors</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;replace&quot;</code>) &#x2014;
Paradigm to follow when decoding bytes to UTF-8. See
<a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="nofollow">bytes.decode</a> for more information.`,name:"errors"},{anchor:"transformers.Qwen2Tokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.Qwen2Tokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The beginning of sequence token. Not applicable for this tokenizer.`,name:"bos_token"},{anchor:"transformers.Qwen2Tokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.Qwen2Tokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.Qwen2Tokenizer.clean_up_tokenization_spaces",description:`<strong>clean_up_tokenization_spaces</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the model should cleanup the spaces that were added when splitting the input text during the
tokenization process. Not applicable to this tokenizer, since tokenization does not add spaces.`,name:"clean_up_tokenization_spaces"},{anchor:"transformers.Qwen2Tokenizer.split_special_tokens",description:`<strong>split_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the special tokens should be split during the tokenization process. The default behavior is
to not split special tokens. This means that if <code>&lt;|endoftext|&gt;</code> is the <code>eos_token</code>, then <code>tokenizer.tokenize(&quot;&lt;|endoftext|&gt;&quot;) = [&apos;&lt;|endoftext|&gt;</code>]. Otherwise, if <code>split_special_tokens=True</code>, then <code>tokenizer.tokenize(&quot;&lt;|endoftext|&gt;&quot;)</code> will be give <code>[&apos;&lt;&apos;, &apos;|&apos;, &apos;endo&apos;, &apos;ft&apos;, &apos;ext&apos;, &apos;|&apos;, &apos;&gt;&apos;]</code>. This argument is only supported for <code>slow</code> tokenizers for the moment.`,name:"split_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/tokenization_qwen2.py#L83"}}),B=new ut({props:{anchor:"transformers.Qwen2Tokenizer.example",$$slots:{default:[zn]},$$scope:{ctx:z}}}),le=new V({props:{name:"save_vocabulary",anchor:"transformers.Qwen2Tokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": Optional = None"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/tokenization_qwen2.py#L308"}}),de=new L({props:{title:"Qwen2TokenizerFast",local:"transformers.Qwen2TokenizerFast",headingTag:"h2"}}),ce=new V({props:{name:"class transformers.Qwen2TokenizerFast",anchor:"transformers.Qwen2TokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"unk_token",val:" = '<|endoftext|>'"},{name:"bos_token",val:" = None"},{name:"eos_token",val:" = '<|endoftext|>'"},{name:"pad_token",val:" = '<|endoftext|>'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Qwen2TokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.Qwen2TokenizerFast.merges_file",description:`<strong>merges_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to the merges file.`,name:"merges_file"},{anchor:"transformers.Qwen2TokenizerFast.tokenizer_file",description:`<strong>tokenizer_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Path to <a href="https://github.com/huggingface/tokenizers" rel="nofollow">tokenizers</a> file (generally has a .json extension) that
contains everything needed to load the tokenizer.`,name:"tokenizer_file"},{anchor:"transformers.Qwen2TokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead. Not applicable to this tokenizer.`,name:"unk_token"},{anchor:"transformers.Qwen2TokenizerFast.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The beginning of sequence token. Not applicable for this tokenizer.`,name:"bos_token"},{anchor:"transformers.Qwen2TokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.Qwen2TokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;|endoftext|&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/tokenization_qwen2_fast.py#L37"}}),N=new ut({props:{anchor:"transformers.Qwen2TokenizerFast.example",$$slots:{default:[Qn]},$$scope:{ctx:z}}}),me=new L({props:{title:"Qwen2Model",local:"transformers.Qwen2Model",headingTag:"h2"}}),pe=new V({props:{name:"class transformers.Qwen2Model",anchor:"transformers.Qwen2Model",parameters:[{name:"config",val:": Qwen2Config"}],parametersDescription:[{anchor:"transformers.Qwen2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2Config">Qwen2Config</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.
config &#x2014; Qwen2Config`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/modeling_qwen2.py#L908"}}),he=new V({props:{name:"forward",anchor:"transformers.Qwen2Model.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"}],parametersDescription:[{anchor:"transformers.Qwen2Model.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.Qwen2Model.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.Qwen2Model.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.Qwen2Model.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Qwen2Model.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.Qwen2Model.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.Qwen2Model.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.Qwen2Model.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.Qwen2Model.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/modeling_qwen2.py#L942"}}),X=new Xt({props:{$$slots:{default:[xn]},$$scope:{ctx:z}}}),ue=new L({props:{title:"Qwen2ForCausalLM",local:"transformers.Qwen2ForCausalLM",headingTag:"h2"}}),fe=new V({props:{name:"class transformers.Qwen2ForCausalLM",anchor:"transformers.Qwen2ForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/modeling_qwen2.py#L1090"}}),ge=new V({props:{name:"forward",anchor:"transformers.Qwen2ForCausalLM.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"}],parametersDescription:[{anchor:"transformers.Qwen2ForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.Qwen2ForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.Qwen2ForCausalLM.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.Qwen2ForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Qwen2ForCausalLM.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.Qwen2ForCausalLM.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.Qwen2ForCausalLM.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.Qwen2ForCausalLM.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.Qwen2ForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.</p>
<p>Args &#x2014;
labels (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>):
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/modeling_qwen2.py#L1120",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),G=new Xt({props:{$$slots:{default:[Cn]},$$scope:{ctx:z}}}),E=new ut({props:{anchor:"transformers.Qwen2ForCausalLM.forward.example",$$slots:{default:[jn]},$$scope:{ctx:z}}}),_e=new L({props:{title:"Qwen2ForSequenceClassification",local:"transformers.Qwen2ForSequenceClassification",headingTag:"h2"}}),we=new V({props:{name:"class transformers.Qwen2ForSequenceClassification",anchor:"transformers.Qwen2ForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Qwen2ForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qwen2#transformers.Qwen2Config">Qwen2Config</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/modeling_qwen2.py#L1276"}}),be=new V({props:{name:"forward",anchor:"transformers.Qwen2ForSequenceClassification.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"}],parametersDescription:[{anchor:"transformers.Qwen2ForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.Qwen2ForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.Qwen2ForSequenceClassification.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.Qwen2ForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Cache</code> or <code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.Qwen2ForSequenceClassification.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.Qwen2ForSequenceClassification.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.Qwen2ForSequenceClassification.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.Qwen2ForSequenceClassification.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.Qwen2ForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Qwen2ForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen2/modeling_qwen2.py#L1307"}}),A=new Xt({props:{$$slots:{default:[Fn]},$$scope:{ctx:z}}}),{c(){t=c("meta"),k=a(),l=c("p"),p=a(),h(y.$$.fragment),i=a(),h(v.$$.fragment),Ge=a(),D=c("p"),D.textContent=Gt,Ee=a(),h(Y.$$.fragment),Ae=a(),K=c("p"),K.textContent=Et,Oe=a(),h(ee.$$.fragment),De=a(),te=c("p"),te.innerHTML=At,Ye=a(),ne=c("p"),ne.innerHTML=Ot,Ke=a(),h(oe.$$.fragment),et=a(),h(se.$$.fragment),tt=a(),j=c("div"),h(ae.$$.fragment),ft=a(),ve=c("p"),ve.innerHTML=Dt,gt=a(),Te=c("p"),Te.innerHTML=Yt,_t=a(),h(S.$$.fragment),nt=a(),h(re.$$.fragment),ot=a(),T=c("div"),h(ie.$$.fragment),wt=a(),Me=c("p"),Me.textContent=Kt,bt=a(),$e=c("p"),$e.textContent=en,kt=a(),h(B.$$.fragment),yt=wn(`
This is expected.
`),ze=c("p"),ze.textContent=tn,vt=a(),Qe=c("p"),Qe.innerHTML=nn,Tt=a(),xe=c("div"),h(le.$$.fragment),st=a(),h(de.$$.fragment),at=a(),Q=c("div"),h(ce.$$.fragment),Mt=a(),Ce=c("p"),Ce.innerHTML=on,$t=a(),je=c("p"),je.textContent=sn,zt=a(),h(N.$$.fragment),Qt=wn(`
This is expected.
`),Fe=c("p"),Fe.innerHTML=an,rt=a(),h(me.$$.fragment),it=a(),x=c("div"),h(pe.$$.fragment),xt=a(),qe=c("p"),qe.innerHTML=rn,Ct=a(),Ue=c("p"),Ue.innerHTML=ln,jt=a(),Ie=c("p"),Ie.innerHTML=dn,Ft=a(),P=c("div"),h(he.$$.fragment),qt=a(),Ze=c("p"),Ze.innerHTML=cn,Ut=a(),h(X.$$.fragment),lt=a(),h(ue.$$.fragment),dt=a(),R=c("div"),h(fe.$$.fragment),It=a(),U=c("div"),h(ge.$$.fragment),Zt=a(),We=c("p"),We.innerHTML=mn,Wt=a(),h(G.$$.fragment),Pt=a(),h(E.$$.fragment),ct=a(),h(_e.$$.fragment),mt=a(),M=c("div"),h(we.$$.fragment),Jt=a(),Pe=c("p"),Pe.textContent=pn,Vt=a(),Je=c("p"),Je.innerHTML=hn,Lt=a(),Ve=c("p"),Ve.innerHTML=un,Rt=a(),Le=c("p"),Le.innerHTML=fn,Ht=a(),Re=c("p"),Re.innerHTML=gn,St=a(),J=c("div"),h(be.$$.fragment),Bt=a(),He=c("p"),He.innerHTML=_n,Nt=a(),h(A.$$.fragment),pt=a(),Be=c("p"),this.h()},l(e){const n=Mn("svelte-u9bgzb",document.head);t=m(n,"META",{name:!0,content:!0}),n.forEach(o),k=r(e),l=m(e,"P",{}),I(l).forEach(o),p=r(e),u(y.$$.fragment,e),i=r(e),u(v.$$.fragment,e),Ge=r(e),D=m(e,"P",{"data-svelte-h":!0}),b(D)!=="svelte-czz8ve"&&(D.textContent=Gt),Ee=r(e),u(Y.$$.fragment,e),Ae=r(e),K=m(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1l7nw08"&&(K.textContent=Et),Oe=r(e),u(ee.$$.fragment,e),De=r(e),te=m(e,"P",{"data-svelte-h":!0}),b(te)!=="svelte-1wynr6y"&&(te.innerHTML=At),Ye=r(e),ne=m(e,"P",{"data-svelte-h":!0}),b(ne)!=="svelte-1xa3n8x"&&(ne.innerHTML=Ot),Ke=r(e),u(oe.$$.fragment,e),et=r(e),u(se.$$.fragment,e),tt=r(e),j=m(e,"DIV",{class:!0});var W=I(j);u(ae.$$.fragment,W),ft=r(W),ve=m(W,"P",{"data-svelte-h":!0}),b(ve)!=="svelte-jj6mgr"&&(ve.innerHTML=Dt),gt=r(W),Te=m(W,"P",{"data-svelte-h":!0}),b(Te)!=="svelte-o55m63"&&(Te.innerHTML=Yt),_t=r(W),u(S.$$.fragment,W),W.forEach(o),nt=r(e),u(re.$$.fragment,e),ot=r(e),T=m(e,"DIV",{class:!0});var $=I(T);u(ie.$$.fragment,$),wt=r($),Me=m($,"P",{"data-svelte-h":!0}),b(Me)!=="svelte-owj012"&&(Me.textContent=Kt),bt=r($),$e=m($,"P",{"data-svelte-h":!0}),b($e)!=="svelte-ei9kk8"&&($e.textContent=en),kt=r($),u(B.$$.fragment,$),yt=bn($,`
This is expected.
`),ze=m($,"P",{"data-svelte-h":!0}),b(ze)!=="svelte-187588w"&&(ze.textContent=tn),vt=r($),Qe=m($,"P",{"data-svelte-h":!0}),b(Qe)!=="svelte-1c3t5ty"&&(Qe.innerHTML=nn),Tt=r($),xe=m($,"DIV",{class:!0});var Ne=I(xe);u(le.$$.fragment,Ne),Ne.forEach(o),$.forEach(o),st=r(e),u(de.$$.fragment,e),at=r(e),Q=m(e,"DIV",{class:!0});var F=I(Q);u(ce.$$.fragment,F),Mt=r(F),Ce=m(F,"P",{"data-svelte-h":!0}),b(Ce)!=="svelte-v6yiax"&&(Ce.innerHTML=on),$t=r(F),je=m(F,"P",{"data-svelte-h":!0}),b(je)!=="svelte-ei9kk8"&&(je.textContent=sn),zt=r(F),u(N.$$.fragment,F),Qt=bn(F,`
This is expected.
`),Fe=m(F,"P",{"data-svelte-h":!0}),b(Fe)!=="svelte-fh0aq"&&(Fe.innerHTML=an),F.forEach(o),rt=r(e),u(me.$$.fragment,e),it=r(e),x=m(e,"DIV",{class:!0});var q=I(x);u(pe.$$.fragment,q),xt=r(q),qe=m(q,"P",{"data-svelte-h":!0}),b(qe)!=="svelte-85adkl"&&(qe.innerHTML=rn),Ct=r(q),Ue=m(q,"P",{"data-svelte-h":!0}),b(Ue)!=="svelte-hswkmf"&&(Ue.innerHTML=ln),jt=r(q),Ie=m(q,"P",{"data-svelte-h":!0}),b(Ie)!=="svelte-uhrr2y"&&(Ie.innerHTML=dn),Ft=r(q),P=m(q,"DIV",{class:!0});var H=I(P);u(he.$$.fragment,H),qt=r(H),Ze=m(H,"P",{"data-svelte-h":!0}),b(Ze)!=="svelte-6pqifo"&&(Ze.innerHTML=cn),Ut=r(H),u(X.$$.fragment,H),H.forEach(o),q.forEach(o),lt=r(e),u(ue.$$.fragment,e),dt=r(e),R=m(e,"DIV",{class:!0});var ke=I(R);u(fe.$$.fragment,ke),It=r(ke),U=m(ke,"DIV",{class:!0});var O=I(U);u(ge.$$.fragment,O),Zt=r(O),We=m(O,"P",{"data-svelte-h":!0}),b(We)!=="svelte-1uc776k"&&(We.innerHTML=mn),Wt=r(O),u(G.$$.fragment,O),Pt=r(O),u(E.$$.fragment,O),O.forEach(o),ke.forEach(o),ct=r(e),u(_e.$$.fragment,e),mt=r(e),M=m(e,"DIV",{class:!0});var C=I(M);u(we.$$.fragment,C),Jt=r(C),Pe=m(C,"P",{"data-svelte-h":!0}),b(Pe)!=="svelte-1xr0wlj"&&(Pe.textContent=pn),Vt=r(C),Je=m(C,"P",{"data-svelte-h":!0}),b(Je)!=="svelte-1ew6odr"&&(Je.innerHTML=hn),Lt=r(C),Ve=m(C,"P",{"data-svelte-h":!0}),b(Ve)!=="svelte-10ugs3m"&&(Ve.innerHTML=un),Rt=r(C),Le=m(C,"P",{"data-svelte-h":!0}),b(Le)!=="svelte-6pahdo"&&(Le.innerHTML=fn),Ht=r(C),Re=m(C,"P",{"data-svelte-h":!0}),b(Re)!=="svelte-hswkmf"&&(Re.innerHTML=gn),St=r(C),J=m(C,"DIV",{class:!0});var Se=I(J);u(be.$$.fragment,Se),Bt=r(Se),He=m(Se,"P",{"data-svelte-h":!0}),b(He)!=="svelte-15bkruu"&&(He.innerHTML=_n),Nt=r(Se),u(A.$$.fragment,Se),Se.forEach(o),C.forEach(o),pt=r(e),Be=m(e,"P",{}),I(Be).forEach(o),this.h()},h(){Z(t,"name","hf:doc:metadata"),Z(t,"content",Un),Z(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(M,"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,n){s(document.head,t),d(e,k,n),d(e,l,n),d(e,p,n),f(y,e,n),d(e,i,n),f(v,e,n),d(e,Ge,n),d(e,D,n),d(e,Ee,n),f(Y,e,n),d(e,Ae,n),d(e,K,n),d(e,Oe,n),f(ee,e,n),d(e,De,n),d(e,te,n),d(e,Ye,n),d(e,ne,n),d(e,Ke,n),f(oe,e,n),d(e,et,n),f(se,e,n),d(e,tt,n),d(e,j,n),f(ae,j,null),s(j,ft),s(j,ve),s(j,gt),s(j,Te),s(j,_t),f(S,j,null),d(e,nt,n),f(re,e,n),d(e,ot,n),d(e,T,n),f(ie,T,null),s(T,wt),s(T,Me),s(T,bt),s(T,$e),s(T,kt),f(B,T,null),s(T,yt),s(T,ze),s(T,vt),s(T,Qe),s(T,Tt),s(T,xe),f(le,xe,null),d(e,st,n),f(de,e,n),d(e,at,n),d(e,Q,n),f(ce,Q,null),s(Q,Mt),s(Q,Ce),s(Q,$t),s(Q,je),s(Q,zt),f(N,Q,null),s(Q,Qt),s(Q,Fe),d(e,rt,n),f(me,e,n),d(e,it,n),d(e,x,n),f(pe,x,null),s(x,xt),s(x,qe),s(x,Ct),s(x,Ue),s(x,jt),s(x,Ie),s(x,Ft),s(x,P),f(he,P,null),s(P,qt),s(P,Ze),s(P,Ut),f(X,P,null),d(e,lt,n),f(ue,e,n),d(e,dt,n),d(e,R,n),f(fe,R,null),s(R,It),s(R,U),f(ge,U,null),s(U,Zt),s(U,We),s(U,Wt),f(G,U,null),s(U,Pt),f(E,U,null),d(e,ct,n),f(_e,e,n),d(e,mt,n),d(e,M,n),f(we,M,null),s(M,Jt),s(M,Pe),s(M,Vt),s(M,Je),s(M,Lt),s(M,Ve),s(M,Rt),s(M,Le),s(M,Ht),s(M,Re),s(M,St),s(M,J),f(be,J,null),s(J,Bt),s(J,He),s(J,Nt),f(A,J,null),d(e,pt,n),d(e,Be,n),ht=!0},p(e,[n]){const W={};n&2&&(W.$$scope={dirty:n,ctx:e}),S.$set(W);const $={};n&2&&($.$$scope={dirty:n,ctx:e}),B.$set($);const Ne={};n&2&&(Ne.$$scope={dirty:n,ctx:e}),N.$set(Ne);const F={};n&2&&(F.$$scope={dirty:n,ctx:e}),X.$set(F);const q={};n&2&&(q.$$scope={dirty:n,ctx:e}),G.$set(q);const H={};n&2&&(H.$$scope={dirty:n,ctx:e}),E.$set(H);const ke={};n&2&&(ke.$$scope={dirty:n,ctx:e}),A.$set(ke)},i(e){ht||(g(y.$$.fragment,e),g(v.$$.fragment,e),g(Y.$$.fragment,e),g(ee.$$.fragment,e),g(oe.$$.fragment,e),g(se.$$.fragment,e),g(ae.$$.fragment,e),g(S.$$.fragment,e),g(re.$$.fragment,e),g(ie.$$.fragment,e),g(B.$$.fragment,e),g(le.$$.fragment,e),g(de.$$.fragment,e),g(ce.$$.fragment,e),g(N.$$.fragment,e),g(me.$$.fragment,e),g(pe.$$.fragment,e),g(he.$$.fragment,e),g(X.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(ge.$$.fragment,e),g(G.$$.fragment,e),g(E.$$.fragment,e),g(_e.$$.fragment,e),g(we.$$.fragment,e),g(be.$$.fragment,e),g(A.$$.fragment,e),ht=!0)},o(e){_(y.$$.fragment,e),_(v.$$.fragment,e),_(Y.$$.fragment,e),_(ee.$$.fragment,e),_(oe.$$.fragment,e),_(se.$$.fragment,e),_(ae.$$.fragment,e),_(S.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(B.$$.fragment,e),_(le.$$.fragment,e),_(de.$$.fragment,e),_(ce.$$.fragment,e),_(N.$$.fragment,e),_(me.$$.fragment,e),_(pe.$$.fragment,e),_(he.$$.fragment,e),_(X.$$.fragment,e),_(ue.$$.fragment,e),_(fe.$$.fragment,e),_(ge.$$.fragment,e),_(G.$$.fragment,e),_(E.$$.fragment,e),_(_e.$$.fragment,e),_(we.$$.fragment,e),_(be.$$.fragment,e),_(A.$$.fragment,e),ht=!1},d(e){e&&(o(k),o(l),o(p),o(i),o(Ge),o(D),o(Ee),o(Ae),o(K),o(Oe),o(De),o(te),o(Ye),o(ne),o(Ke),o(et),o(tt),o(j),o(nt),o(ot),o(T),o(st),o(at),o(Q),o(rt),o(it),o(x),o(lt),o(dt),o(R),o(ct),o(mt),o(M),o(pt),o(Be)),o(t),w(y,e),w(v,e),w(Y,e),w(ee,e),w(oe,e),w(se,e),w(ae),w(S),w(re,e),w(ie),w(B),w(le),w(de,e),w(ce),w(N),w(me,e),w(pe),w(he),w(X),w(ue,e),w(fe),w(ge),w(G),w(E),w(_e,e),w(we),w(be),w(A)}}}const Un='{"title":"Qwen2","local":"qwen2","sections":[{"title":"Overview","local":"overview","sections":[{"title":"Model Details","local":"model-details","sections":[],"depth":3}],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Qwen2Config","local":"transformers.Qwen2Config","sections":[],"depth":2},{"title":"Qwen2Tokenizer","local":"transformers.Qwen2Tokenizer","sections":[],"depth":2},{"title":"Qwen2TokenizerFast","local":"transformers.Qwen2TokenizerFast","sections":[],"depth":2},{"title":"Qwen2Model","local":"transformers.Qwen2Model","sections":[],"depth":2},{"title":"Qwen2ForCausalLM","local":"transformers.Qwen2ForCausalLM","sections":[],"depth":2},{"title":"Qwen2ForSequenceClassification","local":"transformers.Qwen2ForSequenceClassification","sections":[],"depth":2}],"depth":1}';function In(z){return yn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hn extends vn{constructor(t){super(),Tn(this,t,In,qn,kn,{})}}export{Hn as component};
