import{s as Pn,o as Xn,n as Oe}from"../chunks/scheduler.9bc65507.js";import{S as An,i as Qn,g as i,s,r as p,A as Yn,h as l,f as n,c as a,j as H,u as h,x as m,k as R,l as Dn,y as d,a as o,v as u,d as f,t as g,w as _}from"../chunks/index.707bf1b6.js";import{T as cn}from"../chunks/Tip.c2ecdbf4.js";import{D as Ie}from"../chunks/Docstring.17db21ae.js";import{C as We}from"../chunks/CodeBlock.54a9f38d.js";import{E as En}from"../chunks/ExampleCodeBlock.4f515aa9.js";import{H as x}from"../chunks/Heading.342b1fa6.js";function On(z){let r,M;return r=new We({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1pc3RyYWxNb2RlbCUyQyUyME1pc3RyYWxDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwTWlzdHJhbCUyMDdCJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyME1pc3RyYWxDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBNaXN0cmFsJTIwN0IlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyME1pc3RyYWxNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MistralModel, MistralConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Mistral 7B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = MistralConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the Mistral 7B style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = MistralModel(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(){p(r.$$.fragment)},l(c){h(r.$$.fragment,c)},m(c,b){u(r,c,b),M=!0},p:Oe,i(c){M||(f(r.$$.fragment,c),M=!0)},o(c){g(r.$$.fragment,c),M=!1},d(c){_(r,c)}}}function Kn(z){let r,M=`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(){r=i("p"),r.innerHTML=M},l(c){r=l(c,"P",{"data-svelte-h":!0}),m(r)!=="svelte-fincs2"&&(r.innerHTML=M)},m(c,b){o(c,r,b)},p:Oe,d(c){c&&n(r)}}}function eo(z){let r,M=`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(){r=i("p"),r.innerHTML=M},l(c){r=l(c,"P",{"data-svelte-h":!0}),m(r)!=="svelte-fincs2"&&(r.innerHTML=M)},m(c,b){o(c,r,b)},p:Oe,d(c){c&&n(r)}}}function to(z){let r,M="Example:",c,b,F;return b=new We({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBNaXN0cmFsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyME1pc3RyYWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoUEFUSF9UT19DT05WRVJURURfV0VJR0hUUyklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChQQVRIX1RPX0NPTlZFUlRFRF9UT0tFTklaRVIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIySGV5JTJDJTIwYXJlJTIweW91JTIwY29uc2Npb3VzJTNGJTIwQ2FuJTIweW91JTIwdGFsayUyMHRvJTIwbWUlM0YlMjIlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocHJvbXB0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjBHZW5lcmF0ZSUwQWdlbmVyYXRlX2lkcyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cy5pbnB1dF9pZHMlMkMlMjBtYXhfbGVuZ3RoJTNEMzApJTBBdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZV9pZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSUyQyUyMGNsZWFuX3VwX3Rva2VuaXphdGlvbl9zcGFjZXMlM0RGYWxzZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, MistralForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = MistralForCausalLM.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(){r=i("p"),r.textContent=M,c=s(),p(b.$$.fragment)},l(y){r=l(y,"P",{"data-svelte-h":!0}),m(r)!=="svelte-11lpom8"&&(r.textContent=M),c=a(y),h(b.$$.fragment,y)},m(y,L){o(y,r,L),o(y,c,L),u(b,y,L),F=!0},p:Oe,i(y){F||(f(b.$$.fragment,y),F=!0)},o(y){g(b.$$.fragment,y),F=!1},d(y){y&&(n(r),n(c)),_(b,y)}}}function no(z){let r,M=`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(){r=i("p"),r.innerHTML=M},l(c){r=l(c,"P",{"data-svelte-h":!0}),m(r)!=="svelte-fincs2"&&(r.innerHTML=M)},m(c,b){o(c,r,b)},p:Oe,d(c){c&&n(r)}}}function oo(z){let r,M,c,b,F,y,L,Ke,E,mn="Mistral-7B-v0.1 is Mistral AI’s first Large Language Model (LLM).",et,P,tt,X,pn="Mistral-7B-v0.1 is a decoder-based LM with the following architectural choices:",nt,A,hn="<li>Sliding Window Attention - Trained with 8k context length and fixed cache size, with a theoretical attention span of 128K tokens</li> <li>GQA (Grouped Query Attention) - allowing faster inference and lower cache size.</li> <li>Byte-fallback BPE tokenizer - ensures that characters are never mapped to out of vocabulary tokens.</li>",ot,Q,un="We also provide an instruction fine-tuned model: <code>Mistral-7B-Instruct-v0.1</code> which can be used for chat-based inference.",st,Y,fn='For more details please read our <a href="https://mistral.ai/news/announcing-mistral-7b/" rel="nofollow">release blog post</a>',at,D,rt,O,gn="Both <code>Mistral-7B-v0.1</code> and <code>Mistral-7B-Instruct-v0.1</code> are released under the Apache 2.0 license.",it,K,lt,ee,_n='<code>Mistral-7B-v0.1</code> and <code>Mistral-7B-Instruct-v0.1</code> can be found on the <a href="https://huggingface.co/mistralai" rel="nofollow">Huggingface Hub</a>',dt,te,Mn="These ready-to-use checkpoints can be downloaded and used via the HuggingFace Hub:",ct,ne,mt,oe,bn="Raw weights for <code>Mistral-7B-v0.1</code> and <code>Mistral-7B-Instruct-v0.1</code> can be downloaded from:",pt,se,yn='<thead><tr><th>Model Name</th> <th>Checkpoint</th></tr></thead> <tbody><tr><td><code>Mistral-7B-v0.1</code></td> <td><a href="https://files.mistral-7b-v0-1.mistral.ai/mistral-7B-v0.1.tar" rel="nofollow">Raw Checkpoint</a></td></tr> <tr><td><code>Mistral-7B-Instruct-v0.1</code></td> <td><a href="https://files.mistral-7b-v0-1.mistral.ai/mistral-7B-instruct-v0.1.tar" rel="nofollow">Raw Checkpoint</a></td></tr></tbody>',ht,ae,Tn="To use these raw checkpoints with HuggingFace you can use the <code>convert_mistral_weights_to_hf.py</code> script to convert them to the HuggingFace format:",ut,re,ft,ie,vn="You can then load the converted model from the <code>output/path</code>:",gt,le,_t,de,Mt,ce,wn="First, make sure to install the latest version of Flash Attention 2 to include the sliding window attention feature.",bt,me,yt,pe,kn='Make also sure that you have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of <a href="https://github.com/Dao-AILab/flash-attention" rel="nofollow"><code>flash-attn</code></a> repository. Make also sure to load your model in half-precision (e.g. <code>torch.float16</code>)',Tt,he,$n="To load and run a model using Flash Attention 2, refer to the snippet below:",vt,ue,wt,fe,kt,ge,Cn="Below is a expected speedup diagram that compares pure inference time between the native implementation in transformers using <code>mistralai/Mistral-7B-v0.1</code> checkpoint and the Flash Attention 2 version of the model.",$t,B,xn='<img src="https://huggingface.co/datasets/ybelkada/documentation-images/resolve/main/mistral-7b-inference-large-seqlen.png"/>',Ct,_e,xt,Me,zn=`The current implementation supports the sliding window attention mechanism and memory efficient cache management.
To enable sliding window attention, just make sure to have a <code>flash-attn</code> version that is compatible with sliding window attention (<code>&gt;=2.3.0</code>).`,zt,be,Fn="The Flash Attention-2 model uses also a more memory efficient cache slicing mechanism - as recommended per the official implementation of Mistral model that use rolling cache mechanism we keep the cache size fixed (<code>self.config.sliding_window</code>), support batched generation only for <code>padding_side=&quot;left&quot;</code> and use the absolute position of the current token to compute the positional embedding.",Ft,ye,Jt,Te,Jn="Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.",Lt,ve,jt,v,we,Gt,Ze,Ln=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralModel">MistralModel</a>. It is used to instantiate an
Mistral 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 Mistral-7B-v0.1 or Mistral-7B-Instruct-v0.1.`,St,He,jn='<a href="https://huggingface.co/mistralai/Mistral-7B-v0.1" rel="nofollow">mistralai/Mistral-7B-v0.1</a> <a href="https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1" rel="nofollow">mistralai/Mistral-7B-Instruct-v0.1</a>',Vt,Re,Un=`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.`,Nt,q,Ut,ke,It,w,$e,Et,Be,In=`The bare Mistral Model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Pt,qe,Wn=`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.`,Xt,Ge,Zn="Transformer decoder consisting of <em>config.num_hidden_layers</em> layers. Each layer is a <code>MistralDecoderLayer</code>",At,U,Ce,Qt,Se,Hn='The <a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralModel">MistralModel</a> forward method, overrides the <code>__call__</code> special method.',Yt,G,Wt,xe,Zt,W,ze,Dt,J,Fe,Ot,Ve,Rn='The <a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralForCausalLM">MistralForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',Kt,S,en,V,Ht,Je,Rt,T,Le,tn,Ne,Bn="The Mistral Model transformer with a sequence classification head on top (linear layer).",nn,Ee,qn=`<a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralForSequenceClassification">MistralForSequenceClassification</a> uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`,on,Pe,Gn=`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).`,sn,Xe,Sn=`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.)`,an,Ae,Vn=`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.`,rn,I,je,ln,Qe,Nn='The <a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralForSequenceClassification">MistralForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',dn,N,Bt,De,qt;return F=new x({props:{title:"Mistral",local:"mistral",headingTag:"h1"}}),L=new x({props:{title:"Overview",local:"overview",headingTag:"h2"}}),P=new x({props:{title:"Model Details",local:"model-details",headingTag:"h3"}}),D=new x({props:{title:"License",local:"license",headingTag:"h3"}}),K=new x({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),ne=new We({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjAlMjMlMjB0aGUlMjBkZXZpY2UlMjB0byUyMGxvYWQlMjB0aGUlMjBtb2RlbCUyMG9udG8lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJtaXN0cmFsYWklMkZNaXN0cmFsLTdCLXYwLjElMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIybWlzdHJhbGFpJTJGTWlzdHJhbC03Qi12MC4xJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMk15JTIwZmF2b3VyaXRlJTIwY29uZGltZW50JTIwaXMlMjIlMEElMEFtb2RlbF9pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTVCcHJvbXB0JTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlKSUwQW1vZGVsLnRvKGRldmljZSklMEElMEFnZW5lcmF0ZWRfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKiptb2RlbF9pbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDEwMCUyQyUyMGRvX3NhbXBsZSUzRFRydWUpJTBBdG9rZW5pemVyLmJhdGNoX2RlY29kZShnZW5lcmF0ZWRfaWRzKSU1QjAlNUQ=",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;mistralai/Mistral-7B-v0.1&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;mistralai/Mistral-7B-v0.1&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;My favourite condiment is&quot;</span>

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

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**model_inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_ids)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;The expected output&quot;</span>`,wrap:!1}}),re=new We({props:{code:"cHl0aG9uJTIwc3JjJTJGdHJhbnNmb3JtZXJzJTJGbW9kZWxzJTJGbWlzdHJhbCUyRmNvbnZlcnRfbWlzdHJhbF93ZWlnaHRzX3RvX2hmLnB5JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1pbnB1dF9kaXIlMjAlMkZwYXRoJTJGdG8lMkZkb3dubG9hZGVkJTJGbWlzdHJhbCUyRndlaWdodHMlMjAtLW1vZGVsX3NpemUlMjA3QiUyMC0tb3V0cHV0X2RpciUyMCUyRm91dHB1dCUyRnBhdGg=",highlighted:`python src/transformers/models/mistral/convert_mistral_weights_to_hf.py \\
    --input_dir /path/to/downloaded/mistral/weights --model_size 7B --output_dir /output/path`,wrap:!1}}),le=new We({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1pc3RyYWxGb3JDYXVzYWxMTSUyQyUyMExsYW1hVG9rZW5pemVyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwTGxhbWFUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMiUyRm91dHB1dCUyRnBhdGglMjIpJTBBbW9kZWwlMjAlM0QlMjBNaXN0cmFsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMiUyRm91dHB1dCUyRnBhdGglMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> MistralForCausalLM, LlamaTokenizer

tokenizer = LlamaTokenizer.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)
model = MistralForCausalLM.from_pretrained(<span class="hljs-string">&quot;/output/path&quot;</span>)`,wrap:!1}}),de=new x({props:{title:"Combining Mistral and Flash Attention 2",local:"combining-mistral-and-flash-attention-2",headingTag:"h2"}}),me=new We({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),ue=new We({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMkMlMjBBdXRvVG9rZW5pemVyJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMCUyMyUyMHRoZSUyMGRldmljZSUyMHRvJTIwbG9hZCUyMHRoZSUyMG1vZGVsJTIwb250byUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMm1pc3RyYWxhaSUyRk1pc3RyYWwtN0ItdjAuMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMGF0dG5faW1wbGVtZW50YXRpb24lM0QlMjJmbGFzaF9hdHRlbnRpb25fMiUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJtaXN0cmFsYWklMkZNaXN0cmFsLTdCLXYwLjElMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyTXklMjBmYXZvdXJpdGUlMjBjb25kaW1lbnQlMjBpcyUyMiUwQSUwQW1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplciglNUJwcm9tcHQlNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS50byhkZXZpY2UpJTBBbW9kZWwudG8oZGV2aWNlKSUwQSUwQWdlbmVyYXRlZF9pZHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKm1vZGVsX2lucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF9pZHMpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, AutoTokenizer
<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;mistralai/Mistral-7B-v0.1&quot;</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">&quot;flash_attention_2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;mistralai/Mistral-7B-v0.1&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;My favourite condiment is&quot;</span>

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

<span class="hljs-meta">&gt;&gt;&gt; </span>generated_ids = model.generate(**model_inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_ids)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;The expected output&quot;</span>`,wrap:!1}}),fe=new x({props:{title:"Expected speedups",local:"expected-speedups",headingTag:"h3"}}),_e=new x({props:{title:"Sliding window Attention",local:"sliding-window-attention",headingTag:"h3"}}),ye=new x({props:{title:"The Mistral Team",local:"the-mistral-team",headingTag:"h2"}}),ve=new x({props:{title:"MistralConfig",local:"transformers.MistralConfig",headingTag:"h2"}}),we=new Ie({props:{name:"class transformers.MistralConfig",anchor:"transformers.MistralConfig",parameters:[{name:"vocab_size",val:" = 32000"},{name:"hidden_size",val:" = 4096"},{name:"intermediate_size",val:" = 14336"},{name:"num_hidden_layers",val:" = 32"},{name:"num_attention_heads",val:" = 32"},{name:"num_key_value_heads",val:" = 8"},{name:"hidden_act",val:" = 'silu'"},{name:"max_position_embeddings",val:" = 131072"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1e-06"},{name:"use_cache",val:" = True"},{name:"pad_token_id",val:" = None"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"tie_word_embeddings",val:" = False"},{name:"rope_theta",val:" = 10000.0"},{name:"sliding_window",val:" = 4096"},{name:"attention_dropout",val:" = 0.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.MistralConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32000) &#x2014;
Vocabulary size of the Mistral 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/mistral#transformers.MistralModel">MistralModel</a>`,name:"vocab_size"},{anchor:"transformers.MistralConfig.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.MistralConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 14336) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.MistralConfig.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.MistralConfig.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.MistralConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#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>8\`.`,name:"num_key_value_heads"},{anchor:"transformers.MistralConfig.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.MistralConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to <code>4096*32</code>) &#x2014;
The maximum sequence length that this model might ever be used with. Mistral&#x2019;s sliding window attention
allows sequence of up to 4096*32 tokens.`,name:"max_position_embeddings"},{anchor:"transformers.MistralConfig.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.MistralConfig.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.MistralConfig.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.MistralConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The id of the padding token.`,name:"pad_token_id"},{anchor:"transformers.MistralConfig.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.MistralConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The id of the &#x201C;end-of-sequence&#x201D; token.`,name:"eos_token_id"},{anchor:"transformers.MistralConfig.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.MistralConfig.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.MistralConfig.sliding_window",description:`<strong>sliding_window</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Sliding window attention window size. If not specified, will default to <code>4096</code>.`,name:"sliding_window"},{anchor:"transformers.MistralConfig.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/mistral/configuration_mistral.py#L29"}}),q=new En({props:{anchor:"transformers.MistralConfig.example",$$slots:{default:[On]},$$scope:{ctx:z}}}),ke=new x({props:{title:"MistralModel",local:"transformers.MistralModel",headingTag:"h2"}}),$e=new Ie({props:{name:"class transformers.MistralModel",anchor:"transformers.MistralModel",parameters:[{name:"config",val:": MistralConfig"}],parametersDescription:[{anchor:"transformers.MistralModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralConfig">MistralConfig</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; MistralConfig`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mistral/modeling_mistral.py#L898"}}),Ce=new Ie({props:{name:"forward",anchor:"transformers.MistralModel.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MistralModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.MistralModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.MistralModel.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.MistralModel.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.MistralModel.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.MistralModel.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.MistralModel.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.MistralModel.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.MistralModel.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/mistral/modeling_mistral.py#L928"}}),G=new cn({props:{$$slots:{default:[Kn]},$$scope:{ctx:z}}}),xe=new x({props:{title:"MistralForCausalLM",local:"transformers.MistralForCausalLM",headingTag:"h2"}}),ze=new Ie({props:{name:"class transformers.MistralForCausalLM",anchor:"transformers.MistralForCausalLM",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mistral/modeling_mistral.py#L1076"}}),Fe=new Ie({props:{name:"forward",anchor:"transformers.MistralForCausalLM.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MistralForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.MistralForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.MistralForCausalLM.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.MistralForCausalLM.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.MistralForCausalLM.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.MistralForCausalLM.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.MistralForCausalLM.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.MistralForCausalLM.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.MistralForCausalLM.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/mistral/modeling_mistral.py#L1106",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/mistral#transformers.MistralConfig"
>MistralConfig</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>
`}}),S=new cn({props:{$$slots:{default:[eo]},$$scope:{ctx:z}}}),V=new En({props:{anchor:"transformers.MistralForCausalLM.forward.example",$$slots:{default:[to]},$$scope:{ctx:z}}}),Je=new x({props:{title:"MistralForSequenceClassification",local:"transformers.MistralForSequenceClassification",headingTag:"h2"}}),Le=new Ie({props:{name:"class transformers.MistralForSequenceClassification",anchor:"transformers.MistralForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.MistralForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/mistral#transformers.MistralConfig">MistralConfig</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/mistral/modeling_mistral.py#L1278"}}),je=new Ie({props:{name:"forward",anchor:"transformers.MistralForSequenceClassification.forward",parameters:[{name:"input_ids",val:": LongTensor = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.List[torch.FloatTensor]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.MistralForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.MistralForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a></p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/model_doc/fastspeech2_conformer#transformers.FastSpeech2ConformerTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).</p>
<p>If you want to change padding behavior, you should read <code>modeling_opt._prepare_decoder_attention_mask</code>
and modify to your needs. See diagram 1 in <a href="https://arxiv.org/abs/1910.13461" rel="nofollow">the paper</a> for more
information on the default strategy.</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"attention_mask"},{anchor:"transformers.MistralForSequenceClassification.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.MistralForSequenceClassification.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.MistralForSequenceClassification.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.MistralForSequenceClassification.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.MistralForSequenceClassification.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.MistralForSequenceClassification.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.MistralForSequenceClassification.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.MistralForSequenceClassification.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/mistral/modeling_mistral.py#L1294"}}),N=new cn({props:{$$slots:{default:[no]},$$scope:{ctx:z}}}),{c(){r=i("meta"),M=s(),c=i("p"),b=s(),p(F.$$.fragment),y=s(),p(L.$$.fragment),Ke=s(),E=i("p"),E.textContent=mn,et=s(),p(P.$$.fragment),tt=s(),X=i("p"),X.textContent=pn,nt=s(),A=i("ul"),A.innerHTML=hn,ot=s(),Q=i("p"),Q.innerHTML=un,st=s(),Y=i("p"),Y.innerHTML=fn,at=s(),p(D.$$.fragment),rt=s(),O=i("p"),O.innerHTML=gn,it=s(),p(K.$$.fragment),lt=s(),ee=i("p"),ee.innerHTML=_n,dt=s(),te=i("p"),te.textContent=Mn,ct=s(),p(ne.$$.fragment),mt=s(),oe=i("p"),oe.innerHTML=bn,pt=s(),se=i("table"),se.innerHTML=yn,ht=s(),ae=i("p"),ae.innerHTML=Tn,ut=s(),p(re.$$.fragment),ft=s(),ie=i("p"),ie.innerHTML=vn,gt=s(),p(le.$$.fragment),_t=s(),p(de.$$.fragment),Mt=s(),ce=i("p"),ce.textContent=wn,bt=s(),p(me.$$.fragment),yt=s(),pe=i("p"),pe.innerHTML=kn,Tt=s(),he=i("p"),he.textContent=$n,vt=s(),p(ue.$$.fragment),wt=s(),p(fe.$$.fragment),kt=s(),ge=i("p"),ge.innerHTML=Cn,$t=s(),B=i("div"),B.innerHTML=xn,Ct=s(),p(_e.$$.fragment),xt=s(),Me=i("p"),Me.innerHTML=zn,zt=s(),be=i("p"),be.innerHTML=Fn,Ft=s(),p(ye.$$.fragment),Jt=s(),Te=i("p"),Te.textContent=Jn,Lt=s(),p(ve.$$.fragment),jt=s(),v=i("div"),p(we.$$.fragment),Gt=s(),Ze=i("p"),Ze.innerHTML=Ln,St=s(),He=i("p"),He.innerHTML=jn,Vt=s(),Re=i("p"),Re.innerHTML=Un,Nt=s(),p(q.$$.fragment),Ut=s(),p(ke.$$.fragment),It=s(),w=i("div"),p($e.$$.fragment),Et=s(),Be=i("p"),Be.innerHTML=In,Pt=s(),qe=i("p"),qe.innerHTML=Wn,Xt=s(),Ge=i("p"),Ge.innerHTML=Zn,At=s(),U=i("div"),p(Ce.$$.fragment),Qt=s(),Se=i("p"),Se.innerHTML=Hn,Yt=s(),p(G.$$.fragment),Wt=s(),p(xe.$$.fragment),Zt=s(),W=i("div"),p(ze.$$.fragment),Dt=s(),J=i("div"),p(Fe.$$.fragment),Ot=s(),Ve=i("p"),Ve.innerHTML=Rn,Kt=s(),p(S.$$.fragment),en=s(),p(V.$$.fragment),Ht=s(),p(Je.$$.fragment),Rt=s(),T=i("div"),p(Le.$$.fragment),tn=s(),Ne=i("p"),Ne.textContent=Bn,nn=s(),Ee=i("p"),Ee.innerHTML=qn,on=s(),Pe=i("p"),Pe.innerHTML=Gn,sn=s(),Xe=i("p"),Xe.innerHTML=Sn,an=s(),Ae=i("p"),Ae.innerHTML=Vn,rn=s(),I=i("div"),p(je.$$.fragment),ln=s(),Qe=i("p"),Qe.innerHTML=Nn,dn=s(),p(N.$$.fragment),Bt=s(),De=i("p"),this.h()},l(e){const t=Yn("svelte-u9bgzb",document.head);r=l(t,"META",{name:!0,content:!0}),t.forEach(n),M=a(e),c=l(e,"P",{}),H(c).forEach(n),b=a(e),h(F.$$.fragment,e),y=a(e),h(L.$$.fragment,e),Ke=a(e),E=l(e,"P",{"data-svelte-h":!0}),m(E)!=="svelte-1nseuow"&&(E.textContent=mn),et=a(e),h(P.$$.fragment,e),tt=a(e),X=l(e,"P",{"data-svelte-h":!0}),m(X)!=="svelte-unnu27"&&(X.textContent=pn),nt=a(e),A=l(e,"UL",{"data-svelte-h":!0}),m(A)!=="svelte-hqpplt"&&(A.innerHTML=hn),ot=a(e),Q=l(e,"P",{"data-svelte-h":!0}),m(Q)!=="svelte-1w3a9um"&&(Q.innerHTML=un),st=a(e),Y=l(e,"P",{"data-svelte-h":!0}),m(Y)!=="svelte-o5qoei"&&(Y.innerHTML=fn),at=a(e),h(D.$$.fragment,e),rt=a(e),O=l(e,"P",{"data-svelte-h":!0}),m(O)!=="svelte-14253l8"&&(O.innerHTML=gn),it=a(e),h(K.$$.fragment,e),lt=a(e),ee=l(e,"P",{"data-svelte-h":!0}),m(ee)!=="svelte-u5jvf7"&&(ee.innerHTML=_n),dt=a(e),te=l(e,"P",{"data-svelte-h":!0}),m(te)!=="svelte-a5tlwb"&&(te.textContent=Mn),ct=a(e),h(ne.$$.fragment,e),mt=a(e),oe=l(e,"P",{"data-svelte-h":!0}),m(oe)!=="svelte-1jktxis"&&(oe.innerHTML=bn),pt=a(e),se=l(e,"TABLE",{"data-svelte-h":!0}),m(se)!=="svelte-azzqtn"&&(se.innerHTML=yn),ht=a(e),ae=l(e,"P",{"data-svelte-h":!0}),m(ae)!=="svelte-192zt76"&&(ae.innerHTML=Tn),ut=a(e),h(re.$$.fragment,e),ft=a(e),ie=l(e,"P",{"data-svelte-h":!0}),m(ie)!=="svelte-1svz3xz"&&(ie.innerHTML=vn),gt=a(e),h(le.$$.fragment,e),_t=a(e),h(de.$$.fragment,e),Mt=a(e),ce=l(e,"P",{"data-svelte-h":!0}),m(ce)!=="svelte-o3pzzu"&&(ce.textContent=wn),bt=a(e),h(me.$$.fragment,e),yt=a(e),pe=l(e,"P",{"data-svelte-h":!0}),m(pe)!=="svelte-qk7tod"&&(pe.innerHTML=kn),Tt=a(e),he=l(e,"P",{"data-svelte-h":!0}),m(he)!=="svelte-14hchid"&&(he.textContent=$n),vt=a(e),h(ue.$$.fragment,e),wt=a(e),h(fe.$$.fragment,e),kt=a(e),ge=l(e,"P",{"data-svelte-h":!0}),m(ge)!=="svelte-lhkvj8"&&(ge.innerHTML=Cn),$t=a(e),B=l(e,"DIV",{style:!0,"data-svelte-h":!0}),m(B)!=="svelte-18u0t8d"&&(B.innerHTML=xn),Ct=a(e),h(_e.$$.fragment,e),xt=a(e),Me=l(e,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-10i6fhp"&&(Me.innerHTML=zn),zt=a(e),be=l(e,"P",{"data-svelte-h":!0}),m(be)!=="svelte-1bvsrfr"&&(be.innerHTML=Fn),Ft=a(e),h(ye.$$.fragment,e),Jt=a(e),Te=l(e,"P",{"data-svelte-h":!0}),m(Te)!=="svelte-15xllx1"&&(Te.textContent=Jn),Lt=a(e),h(ve.$$.fragment,e),jt=a(e),v=l(e,"DIV",{class:!0});var $=H(v);h(we.$$.fragment,$),Gt=a($),Ze=l($,"P",{"data-svelte-h":!0}),m(Ze)!=="svelte-14v0v0n"&&(Ze.innerHTML=Ln),St=a($),He=l($,"P",{"data-svelte-h":!0}),m(He)!=="svelte-28p57e"&&(He.innerHTML=jn),Vt=a($),Re=l($,"P",{"data-svelte-h":!0}),m(Re)!=="svelte-o55m63"&&(Re.innerHTML=Un),Nt=a($),h(q.$$.fragment,$),$.forEach(n),Ut=a(e),h(ke.$$.fragment,e),It=a(e),w=l(e,"DIV",{class:!0});var C=H(w);h($e.$$.fragment,C),Et=a(C),Be=l(C,"P",{"data-svelte-h":!0}),m(Be)!=="svelte-tk9y80"&&(Be.innerHTML=In),Pt=a(C),qe=l(C,"P",{"data-svelte-h":!0}),m(qe)!=="svelte-hswkmf"&&(qe.innerHTML=Wn),Xt=a(C),Ge=l(C,"P",{"data-svelte-h":!0}),m(Ge)!=="svelte-1oenqzd"&&(Ge.innerHTML=Zn),At=a(C),U=l(C,"DIV",{class:!0});var Z=H(U);h(Ce.$$.fragment,Z),Qt=a(Z),Se=l(Z,"P",{"data-svelte-h":!0}),m(Se)!=="svelte-3rq1wp"&&(Se.innerHTML=Hn),Yt=a(Z),h(G.$$.fragment,Z),Z.forEach(n),C.forEach(n),Wt=a(e),h(xe.$$.fragment,e),Zt=a(e),W=l(e,"DIV",{class:!0});var Ue=H(W);h(ze.$$.fragment,Ue),Dt=a(Ue),J=l(Ue,"DIV",{class:!0});var j=H(J);h(Fe.$$.fragment,j),Ot=a(j),Ve=l(j,"P",{"data-svelte-h":!0}),m(Ve)!=="svelte-1bgwutx"&&(Ve.innerHTML=Rn),Kt=a(j),h(S.$$.fragment,j),en=a(j),h(V.$$.fragment,j),j.forEach(n),Ue.forEach(n),Ht=a(e),h(Je.$$.fragment,e),Rt=a(e),T=l(e,"DIV",{class:!0});var k=H(T);h(Le.$$.fragment,k),tn=a(k),Ne=l(k,"P",{"data-svelte-h":!0}),m(Ne)!=="svelte-1r7clz4"&&(Ne.textContent=Bn),nn=a(k),Ee=l(k,"P",{"data-svelte-h":!0}),m(Ee)!=="svelte-oiiwva"&&(Ee.innerHTML=qn),on=a(k),Pe=l(k,"P",{"data-svelte-h":!0}),m(Pe)!=="svelte-10ugs3m"&&(Pe.innerHTML=Gn),sn=a(k),Xe=l(k,"P",{"data-svelte-h":!0}),m(Xe)!=="svelte-6pahdo"&&(Xe.innerHTML=Sn),an=a(k),Ae=l(k,"P",{"data-svelte-h":!0}),m(Ae)!=="svelte-hswkmf"&&(Ae.innerHTML=Vn),rn=a(k),I=l(k,"DIV",{class:!0});var Ye=H(I);h(je.$$.fragment,Ye),ln=a(Ye),Qe=l(Ye,"P",{"data-svelte-h":!0}),m(Qe)!=="svelte-1bksa9b"&&(Qe.innerHTML=Nn),dn=a(Ye),h(N.$$.fragment,Ye),Ye.forEach(n),k.forEach(n),Bt=a(e),De=l(e,"P",{}),H(De).forEach(n),this.h()},h(){R(r,"name","hf:doc:metadata"),R(r,"content",so),Dn(B,"text-align","center"),R(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){d(document.head,r),o(e,M,t),o(e,c,t),o(e,b,t),u(F,e,t),o(e,y,t),u(L,e,t),o(e,Ke,t),o(e,E,t),o(e,et,t),u(P,e,t),o(e,tt,t),o(e,X,t),o(e,nt,t),o(e,A,t),o(e,ot,t),o(e,Q,t),o(e,st,t),o(e,Y,t),o(e,at,t),u(D,e,t),o(e,rt,t),o(e,O,t),o(e,it,t),u(K,e,t),o(e,lt,t),o(e,ee,t),o(e,dt,t),o(e,te,t),o(e,ct,t),u(ne,e,t),o(e,mt,t),o(e,oe,t),o(e,pt,t),o(e,se,t),o(e,ht,t),o(e,ae,t),o(e,ut,t),u(re,e,t),o(e,ft,t),o(e,ie,t),o(e,gt,t),u(le,e,t),o(e,_t,t),u(de,e,t),o(e,Mt,t),o(e,ce,t),o(e,bt,t),u(me,e,t),o(e,yt,t),o(e,pe,t),o(e,Tt,t),o(e,he,t),o(e,vt,t),u(ue,e,t),o(e,wt,t),u(fe,e,t),o(e,kt,t),o(e,ge,t),o(e,$t,t),o(e,B,t),o(e,Ct,t),u(_e,e,t),o(e,xt,t),o(e,Me,t),o(e,zt,t),o(e,be,t),o(e,Ft,t),u(ye,e,t),o(e,Jt,t),o(e,Te,t),o(e,Lt,t),u(ve,e,t),o(e,jt,t),o(e,v,t),u(we,v,null),d(v,Gt),d(v,Ze),d(v,St),d(v,He),d(v,Vt),d(v,Re),d(v,Nt),u(q,v,null),o(e,Ut,t),u(ke,e,t),o(e,It,t),o(e,w,t),u($e,w,null),d(w,Et),d(w,Be),d(w,Pt),d(w,qe),d(w,Xt),d(w,Ge),d(w,At),d(w,U),u(Ce,U,null),d(U,Qt),d(U,Se),d(U,Yt),u(G,U,null),o(e,Wt,t),u(xe,e,t),o(e,Zt,t),o(e,W,t),u(ze,W,null),d(W,Dt),d(W,J),u(Fe,J,null),d(J,Ot),d(J,Ve),d(J,Kt),u(S,J,null),d(J,en),u(V,J,null),o(e,Ht,t),u(Je,e,t),o(e,Rt,t),o(e,T,t),u(Le,T,null),d(T,tn),d(T,Ne),d(T,nn),d(T,Ee),d(T,on),d(T,Pe),d(T,sn),d(T,Xe),d(T,an),d(T,Ae),d(T,rn),d(T,I),u(je,I,null),d(I,ln),d(I,Qe),d(I,dn),u(N,I,null),o(e,Bt,t),o(e,De,t),qt=!0},p(e,[t]){const $={};t&2&&($.$$scope={dirty:t,ctx:e}),q.$set($);const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),G.$set(C);const Z={};t&2&&(Z.$$scope={dirty:t,ctx:e}),S.$set(Z);const Ue={};t&2&&(Ue.$$scope={dirty:t,ctx:e}),V.$set(Ue);const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),N.$set(j)},i(e){qt||(f(F.$$.fragment,e),f(L.$$.fragment,e),f(P.$$.fragment,e),f(D.$$.fragment,e),f(K.$$.fragment,e),f(ne.$$.fragment,e),f(re.$$.fragment,e),f(le.$$.fragment,e),f(de.$$.fragment,e),f(me.$$.fragment,e),f(ue.$$.fragment,e),f(fe.$$.fragment,e),f(_e.$$.fragment,e),f(ye.$$.fragment,e),f(ve.$$.fragment,e),f(we.$$.fragment,e),f(q.$$.fragment,e),f(ke.$$.fragment,e),f($e.$$.fragment,e),f(Ce.$$.fragment,e),f(G.$$.fragment,e),f(xe.$$.fragment,e),f(ze.$$.fragment,e),f(Fe.$$.fragment,e),f(S.$$.fragment,e),f(V.$$.fragment,e),f(Je.$$.fragment,e),f(Le.$$.fragment,e),f(je.$$.fragment,e),f(N.$$.fragment,e),qt=!0)},o(e){g(F.$$.fragment,e),g(L.$$.fragment,e),g(P.$$.fragment,e),g(D.$$.fragment,e),g(K.$$.fragment,e),g(ne.$$.fragment,e),g(re.$$.fragment,e),g(le.$$.fragment,e),g(de.$$.fragment,e),g(me.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(_e.$$.fragment,e),g(ye.$$.fragment,e),g(ve.$$.fragment,e),g(we.$$.fragment,e),g(q.$$.fragment,e),g(ke.$$.fragment,e),g($e.$$.fragment,e),g(Ce.$$.fragment,e),g(G.$$.fragment,e),g(xe.$$.fragment,e),g(ze.$$.fragment,e),g(Fe.$$.fragment,e),g(S.$$.fragment,e),g(V.$$.fragment,e),g(Je.$$.fragment,e),g(Le.$$.fragment,e),g(je.$$.fragment,e),g(N.$$.fragment,e),qt=!1},d(e){e&&(n(M),n(c),n(b),n(y),n(Ke),n(E),n(et),n(tt),n(X),n(nt),n(A),n(ot),n(Q),n(st),n(Y),n(at),n(rt),n(O),n(it),n(lt),n(ee),n(dt),n(te),n(ct),n(mt),n(oe),n(pt),n(se),n(ht),n(ae),n(ut),n(ft),n(ie),n(gt),n(_t),n(Mt),n(ce),n(bt),n(yt),n(pe),n(Tt),n(he),n(vt),n(wt),n(kt),n(ge),n($t),n(B),n(Ct),n(xt),n(Me),n(zt),n(be),n(Ft),n(Jt),n(Te),n(Lt),n(jt),n(v),n(Ut),n(It),n(w),n(Wt),n(Zt),n(W),n(Ht),n(Rt),n(T),n(Bt),n(De)),n(r),_(F,e),_(L,e),_(P,e),_(D,e),_(K,e),_(ne,e),_(re,e),_(le,e),_(de,e),_(me,e),_(ue,e),_(fe,e),_(_e,e),_(ye,e),_(ve,e),_(we),_(q),_(ke,e),_($e),_(Ce),_(G),_(xe,e),_(ze),_(Fe),_(S),_(V),_(Je,e),_(Le),_(je),_(N)}}}const so='{"title":"Mistral","local":"mistral","sections":[{"title":"Overview","local":"overview","sections":[{"title":"Model Details","local":"model-details","sections":[],"depth":3},{"title":"License","local":"license","sections":[],"depth":3}],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[],"depth":2},{"title":"Combining Mistral and Flash Attention 2","local":"combining-mistral-and-flash-attention-2","sections":[{"title":"Expected speedups","local":"expected-speedups","sections":[],"depth":3},{"title":"Sliding window Attention","local":"sliding-window-attention","sections":[],"depth":3}],"depth":2},{"title":"The Mistral Team","local":"the-mistral-team","sections":[],"depth":2},{"title":"MistralConfig","local":"transformers.MistralConfig","sections":[],"depth":2},{"title":"MistralModel","local":"transformers.MistralModel","sections":[],"depth":2},{"title":"MistralForCausalLM","local":"transformers.MistralForCausalLM","sections":[],"depth":2},{"title":"MistralForSequenceClassification","local":"transformers.MistralForSequenceClassification","sections":[],"depth":2}],"depth":1}';function ao(z){return Xn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class uo extends An{constructor(r){super(),Qn(this,r,ao,oo,Pn,{})}}export{uo as component};
