import{S as Al,i as Pl,s as Bl,e as r,k as m,w as v,t as s,M as Sl,c as l,d as t,m as f,a as i,x as w,h as a,b as h,G as e,g as b,y as T,q as k,o as F,B as M,v as Vl,L as tt}from"../../chunks/vendor-hf-doc-builder.js";import{T as et}from"../../chunks/Tip-hf-doc-builder.js";import{D as A}from"../../chunks/Docstring-hf-doc-builder.js";import{C as nt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as me}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ot}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Xl($){let c,y,u,p,_;return{c(){c=r("p"),y=s(`Falcon models were initially added to the Hugging Face Hub as custom code checkpoints. However, Falcon is now fully
supported in the Transformers library. If you fine-tuned a model from a custom code checkpoint, we recommend converting
your checkpoint to the new in-library format, as this should give significant improvements to stability and
performance, especially for generation, as well as removing the need to use `),u=r("code"),p=s("trust_remote_code=True"),_=s("!")},l(n){c=l(n,"P",{});var d=i(c);y=a(d,`Falcon models were initially added to the Hugging Face Hub as custom code checkpoints. However, Falcon is now fully
supported in the Transformers library. If you fine-tuned a model from a custom code checkpoint, we recommend converting
your checkpoint to the new in-library format, as this should give significant improvements to stability and
performance, especially for generation, as well as removing the need to use `),u=l(d,"CODE",{});var C=i(u);p=a(C,"trust_remote_code=True"),C.forEach(t),_=a(d,"!"),d.forEach(t)},m(n,d){b(n,c,d),e(c,y),e(c,u),e(u,p),e(c,_)},d(n){n&&t(c)}}}function Ql($){let c,y,u,p,_;return p=new nt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZhbGNvbk1vZGVsJTJDJTIwRmFsY29uQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMHNtYWxsJTIwKDItbGF5ZXIpJTIwRmFsY29uJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBGYWxjb25Db25maWcobnVtX2hpZGRlbl9sYXllcnMlM0QyKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBzbWFsbCUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyMEZhbGNvbk1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python"><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FalconModel, FalconConfig</span>

<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python"><span class="hljs-comment"># Initializing a small (2-layer) Falcon configuration</span></span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">configuration = FalconConfig(num_hidden_layers=<span class="hljs-number">2</span>)</span>

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

<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python"><span class="hljs-comment"># Accessing the model configuration</span></span>
<span class="hljs-meta">&gt;&gt;&gt;</span> <span class="language-python">configuration = model.config</span>`}}),{c(){c=r("p"),y=s("Example:"),u=m(),v(p.$$.fragment)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Example:"),d.forEach(t),u=f(n),w(p.$$.fragment,n)},m(n,d){b(n,c,d),e(c,y),b(n,u,d),T(p,n,d),_=!0},p:tt,i(n){_||(k(p.$$.fragment,n),_=!0)},o(n){F(p.$$.fragment,n),_=!1},d(n){n&&t(c),n&&t(u),M(p,n)}}}function Yl($){let c,y,u,p,_;return{c(){c=r("p"),y=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r("code"),p=s("Module"),_=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(d,"CODE",{});var C=i(u);p=a(C,"Module"),C.forEach(t),_=a(d,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),d.forEach(t)},m(n,d){b(n,c,d),e(c,y),e(c,u),e(u,p),e(c,_)},d(n){n&&t(c)}}}function Ll($){let c,y,u,p,_;return p=new nt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGYWxjb25Nb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyUm9ja2V0a25pZ2h0MSUyRmZhbGNvbi1ydy0xYiUyMiklMEFtb2RlbCUyMCUzRCUyMEZhbGNvbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJSb2NrZXRrbmlnaHQxJTJGZmFsY29uLXJ3LTFiJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FalconModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconModel.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){c=r("p"),y=s("Example:"),u=m(),v(p.$$.fragment)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Example:"),d.forEach(t),u=f(n),w(p.$$.fragment,n)},m(n,d){b(n,c,d),e(c,y),b(n,u,d),T(p,n,d),_=!0},p:tt,i(n){_||(k(p.$$.fragment,n),_=!0)},o(n){F(p.$$.fragment,n),_=!1},d(n){n&&t(c),n&&t(u),M(p,n)}}}function Hl($){let c,y,u,p,_;return{c(){c=r("p"),y=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r("code"),p=s("Module"),_=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(d,"CODE",{});var C=i(u);p=a(C,"Module"),C.forEach(t),_=a(d,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),d.forEach(t)},m(n,d){b(n,c,d),e(c,y),e(c,u),e(u,p),e(c,_)},d(n){n&&t(c)}}}function Ol($){let c,y,u,p,_;return p=new nt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEZhbGNvbkZvckNhdXNhbExNJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyUm9ja2V0a25pZ2h0MSUyRmZhbGNvbi1ydy0xYiUyMiklMEFtb2RlbCUyMCUzRCUyMEZhbGNvbkZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJSb2NrZXRrbmlnaHQxJTJGZmFsY29uLXJ3LTFiJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQpJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",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> AutoTokenizer, FalconForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconForCausalLM.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){c=r("p"),y=s("Example:"),u=m(),v(p.$$.fragment)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Example:"),d.forEach(t),u=f(n),w(p.$$.fragment,n)},m(n,d){b(n,c,d),e(c,y),b(n,u,d),T(p,n,d),_=!0},p:tt,i(n){_||(k(p.$$.fragment,n),_=!0)},o(n){F(p.$$.fragment,n),_=!1},d(n){n&&t(c),n&&t(u),M(p,n)}}}function Dl($){let c,y,u,p,_;return{c(){c=r("p"),y=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r("code"),p=s("Module"),_=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(d,"CODE",{});var C=i(u);p=a(C,"Module"),C.forEach(t),_=a(d,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),d.forEach(t)},m(n,d){b(n,c,d),e(c,y),e(c,u),e(u,p),e(c,_)},d(n){n&&t(c)}}}function Kl($){let c,y,u,p,_;return p=new nt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEZhbGNvbkZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJSb2NrZXRrbmlnaHQxJTJGZmFsY29uLXJ3LTFiJTIyKSUwQW1vZGVsJTIwJTNEJTIwRmFsY29uRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyUm9ja2V0a25pZ2h0MSUyRmZhbGNvbi1ydy0xYiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KCkuaXRlbSgpJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwRmFsY29uRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyUm9ja2V0a25pZ2h0MSUyRmZhbGNvbi1ydy0xYiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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> AutoTokenizer, FalconForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){c=r("p"),y=s("Example of single-label classification:"),u=m(),v(p.$$.fragment)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Example of single-label classification:"),d.forEach(t),u=f(n),w(p.$$.fragment,n)},m(n,d){b(n,c,d),e(c,y),b(n,u,d),T(p,n,d),_=!0},p:tt,i(n){_||(k(p.$$.fragment,n),_=!0)},o(n){F(p.$$.fragment,n),_=!1},d(n){n&&t(c),n&&t(u),M(p,n)}}}function ei($){let c,y,u,p,_;return p=new nt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEZhbGNvbkZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJSb2NrZXRrbmlnaHQxJTJGZmFsY29uLXJ3LTFiJTIyKSUwQW1vZGVsJTIwJTNEJTIwRmFsY29uRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyUm9ja2V0a25pZ2h0MSUyRmZhbGNvbi1ydy0xYiUyMiUyQyUyMHByb2JsZW1fdHlwZSUzRCUyMm11bHRpX2xhYmVsX2NsYXNzaWZpY2F0aW9uJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZHMlMjAlM0QlMjB0b3JjaC5hcmFuZ2UoMCUyQyUyMGxvZ2l0cy5zaGFwZSU1Qi0xJTVEKSU1QnRvcmNoLnNpZ21vaWQobG9naXRzKS5zcXVlZXplKGRpbSUzRDApJTIwJTNFJTIwMC41JTVEJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwRmFsY29uRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyUm9ja2V0a25pZ2h0MSUyRmZhbGNvbi1ydy0xYiUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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> AutoTokenizer, FalconForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) &gt; <span class="hljs-number">0.5</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.<span class="hljs-built_in">sum</span>(
<span class="hljs-meta">... </span>    torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span>
<span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){c=r("p"),y=s("Example of multi-label classification:"),u=m(),v(p.$$.fragment)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Example of multi-label classification:"),d.forEach(t),u=f(n),w(p.$$.fragment,n)},m(n,d){b(n,c,d),e(c,y),b(n,u,d),T(p,n,d),_=!0},p:tt,i(n){_||(k(p.$$.fragment,n),_=!0)},o(n){F(p.$$.fragment,n),_=!1},d(n){n&&t(c),n&&t(u),M(p,n)}}}function oi($){let c,y,u,p,_;return{c(){c=r("p"),y=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r("code"),p=s("Module"),_=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(d,"CODE",{});var C=i(u);p=a(C,"Module"),C.forEach(t),_=a(d,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),d.forEach(t)},m(n,d){b(n,c,d),e(c,y),e(c,u),e(u,p),e(c,_)},d(n){n&&t(c)}}}function ti($){let c,y,u,p,_;return p=new nt({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGYWxjb25Gb3JUb2tlbkNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJSb2NrZXRrbmlnaHQxJTJGZmFsY29uLXJ3LTFiJTIyKSUwQW1vZGVsJTIwJTNEJTIwRmFsY29uRm9yVG9rZW5DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyUm9ja2V0a25pZ2h0MSUyRmZhbGNvbi1ydy0xYiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIySHVnZ2luZ0ZhY2UlMjBpcyUyMGElMjBjb21wYW55JTIwYmFzZWQlMjBpbiUyMFBhcmlzJTIwYW5kJTIwTmV3JTIwWW9yayUyMiUyQyUyMGFkZF9zcGVjaWFsX3Rva2VucyUzREZhbHNlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUwQSklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKSUwQSUwQSUyMyUyME5vdGUlMjB0aGF0JTIwdG9rZW5zJTIwYXJlJTIwY2xhc3NpZmllZCUyMHJhdGhlciUyMHRoZW4lMjBpbnB1dCUyMHdvcmRzJTIwd2hpY2glMjBtZWFucyUyMHRoYXQlMEElMjMlMjB0aGVyZSUyMG1pZ2h0JTIwYmUlMjBtb3JlJTIwcHJlZGljdGVkJTIwdG9rZW4lMjBjbGFzc2VzJTIwdGhhbiUyMHdvcmRzLiUwQSUyMyUyME11bHRpcGxlJTIwdG9rZW4lMjBjbGFzc2VzJTIwbWlnaHQlMjBhY2NvdW50JTIwZm9yJTIwdGhlJTIwc2FtZSUyMHdvcmQlMEFwcmVkaWN0ZWRfdG9rZW5zX2NsYXNzZXMlMjAlM0QlMjAlNUJtb2RlbC5jb25maWcuaWQybGFiZWwlNUJ0Lml0ZW0oKSU1RCUyMGZvciUyMHQlMjBpbiUyMHByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlNUIwJTVEJTVEJTBBJTBBbGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FalconForTokenClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconForTokenClassification.from_pretrained(<span class="hljs-string">&quot;Rocketknight1/falcon-rw-1b&quot;</span>)

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = predicted_token_class_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){c=r("p"),y=s("Example:"),u=m(),v(p.$$.fragment)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Example:"),d.forEach(t),u=f(n),w(p.$$.fragment,n)},m(n,d){b(n,c,d),e(c,y),b(n,u,d),T(p,n,d),_=!0},p:tt,i(n){_||(k(p.$$.fragment,n),_=!0)},o(n){F(p.$$.fragment,n),_=!1},d(n){n&&t(c),n&&t(u),M(p,n)}}}function ni($){let c,y,u,p,_;return{c(){c=r("p"),y=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r("code"),p=s("Module"),_=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(n){c=l(n,"P",{});var d=i(c);y=a(d,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=l(d,"CODE",{});var C=i(u);p=a(C,"Module"),C.forEach(t),_=a(d,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),d.forEach(t)},m(n,d){b(n,c,d),e(c,y),e(c,u),e(u,p),e(c,_)},d(n){n&&t(c)}}}function si($){let c,y,u,p,_,n,d,C,Un,Qt,O,fe,st,Ae,xn,at,In,Yt,P,Wn,Pe,Zn,Nn,Be,qn,Rn,Lt,ge,Gn,rt,An,Pn,Ht,_e,Bn,Se,Sn,Vn,Ot,D,be,lt,Ve,Xn,it,Qn,Dt,ye,Kt,x,Yn,ct,Ln,Hn,Xe,On,Dn,dt,Kn,es,ht,os,ts,en,K,ve,pt,Qe,ns,ut,ss,on,Z,Ye,as,ee,rs,jo,ls,is,Le,cs,ds,hs,oe,ps,zo,us,ms,Uo,fs,gs,_s,we,tn,te,Te,mt,He,bs,ft,ys,nn,E,Oe,vs,gt,ws,Ts,De,ks,xo,Fs,Ms,$s,Ke,Cs,eo,Js,Es,js,q,oo,zs,ne,Us,Io,xs,Is,_t,Ws,Zs,Ns,ke,qs,Fe,sn,se,Me,bt,to,Rs,yt,Gs,an,j,no,As,vt,Ps,Bs,so,Ss,Wo,Vs,Xs,Qs,ao,Ys,ro,Ls,Hs,Os,R,lo,Ds,ae,Ks,Zo,ea,oa,wt,ta,na,sa,$e,aa,Ce,rn,re,Je,Tt,io,ra,kt,la,ln,J,co,ia,Ft,ca,da,No,qo,ha,pa,ua,N,ma,Mt,fa,ga,$t,_a,ba,Ct,ya,va,Jt,wa,Ta,ka,ho,Fa,Ro,Ma,$a,Ca,po,Ja,uo,Ea,ja,za,I,mo,Ua,le,xa,Go,Ia,Wa,Et,Za,Na,qa,Ee,Ra,je,Ga,ze,cn,ie,Ue,jt,fo,Aa,zt,Pa,dn,z,go,Ba,Ut,Sa,Va,_o,Xa,Ao,Qa,Ya,La,bo,Ha,yo,Oa,Da,Ka,G,vo,er,ce,or,Po,tr,nr,xt,sr,ar,rr,xe,lr,Ie,hn,de,We,It,wo,ir,Wt,cr,pn,U,To,dr,he,hr,Zt,pr,ur,Nt,mr,fr,gr,ko,_r,Bo,br,yr,vr,Fo,wr,Mo,Tr,kr,Fr,B,$o,Mr,pe,$r,So,Cr,Jr,qt,Er,jr,zr,Ze,un;return n=new me({}),Ae=new me({}),Ve=new me({}),ye=new et({props:{$$slots:{default:[Xl]},$$scope:{ctx:$}}}),Qe=new me({}),Ye=new A({props:{name:"class transformers.FalconConfig",anchor:"transformers.FalconConfig",parameters:[{name:"vocab_size",val:" = 65024"},{name:"hidden_size",val:" = 4544"},{name:"num_hidden_layers",val:" = 32"},{name:"num_attention_heads",val:" = 71"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"use_cache",val:" = True"},{name:"hidden_dropout",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"num_kv_heads",val:" = None"},{name:"alibi",val:" = False"},{name:"new_decoder_architecture",val:" = False"},{name:"multi_query",val:" = True"},{name:"parallel_attn",val:" = True"},{name:"bias",val:" = False"},{name:"max_position_embeddings",val:" = 2048"},{name:"rope_theta",val:" = 10000.0"},{name:"rope_scaling",val:" = None"},{name:"bos_token_id",val:" = 11"},{name:"eos_token_id",val:" = 11"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FalconConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 65024) &#x2014;
Vocabulary size of the Falcon model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconModel">FalconModel</a>`,name:"vocab_size"},{anchor:"transformers.FalconConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4544) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.FalconConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Number of hidden layers in the Transformer decoder.`,name:"num_hidden_layers"},{anchor:"transformers.FalconConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 71) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.FalconConfig.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.FalconConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether 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.FalconConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.FalconConfig.hidden_dropout",description:`<strong>hidden_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for MLP layers.`,name:"hidden_dropout"},{anchor:"transformers.FalconConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for attention layers.`,name:"attention_dropout"},{anchor:"transformers.FalconConfig.num_kv_heads",description:`<strong>num_kv_heads</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of key-value heads to use per attention layer. If unset, defaults to the same value as
<code>num_attention_heads</code>.`,name:"num_kv_heads"},{anchor:"transformers.FalconConfig.alibi",description:`<strong>alibi</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use ALiBi positional biases during self-attention.`,name:"alibi"},{anchor:"transformers.FalconConfig.new_decoder_architecture",description:`<strong>new_decoder_architecture</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use the new (Falcon-40B) decoder architecture. If <code>True</code>, the <code>multi_query</code> and <code>parallel_attn</code>
arguments are ignored, as the new decoder always uses parallel attention.`,name:"new_decoder_architecture"},{anchor:"transformers.FalconConfig.multi_query",description:`<strong>multi_query</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use multi-query attention in the decoder. Ignored when <code>new_decoder_architecture</code> is <code>True</code>.`,name:"multi_query"},{anchor:"transformers.FalconConfig.parallel_attn",description:`<strong>parallel_attn</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to compute attention in parallel with the feedforward layer. If False, they are consecutive
instead, as in the original Transformer architecture. Ignored when <code>new_decoder_architecture</code> is <code>True</code>.`,name:"parallel_attn"},{anchor:"transformers.FalconConfig.bias",description:`<strong>bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use bias on Linear layers.`,name:"bias"},{anchor:"transformers.FalconConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sequence length that this model might ever be used with, when <code>alibi</code> is <code>False</code>. Pretrained
Falcon models with RoPE support up to 2048 tokens.`,name:"max_position_embeddings"},{anchor:"transformers.FalconConfig.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.FalconConfig.rope_scaling",description:`<strong>rope_scaling</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
strategies: linear and dynamic. Their scaling factor must be an float greater than 1. The expected format
is <code>{&quot;type&quot;: strategy name, &quot;factor&quot;: scaling factor}</code>. When using this flag, don&#x2019;t update
<code>max_position_embeddings</code> to the expected new maximum. See the following thread for more information on how
these scaling strategies behave:
<a href="https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/" rel="nofollow">https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/</a>. This is an
experimental feature, subject to breaking API changes in future versions.`,name:"rope_scaling"},{anchor:"transformers.FalconConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 11) &#x2014;
The id of the &#x201C;beginning-of-sequence&#x201D; token.`,name:"bos_token_id"},{anchor:"transformers.FalconConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 11) &#x2014;
The id of the &#x201C;end-of-sequence&#x201D; token.`,name:"eos_token_id"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/falcon/configuration_falcon.py#L32"}}),we=new ot({props:{anchor:"transformers.FalconConfig.example",$$slots:{default:[Ql]},$$scope:{ctx:$}}}),He=new me({}),Oe=new A({props:{name:"class transformers.FalconModel",anchor:"transformers.FalconModel",parameters:[{name:"config",val:": FalconConfig"}],parametersDescription:[{anchor:"transformers.FalconModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconConfig">FalconConfig</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/v4.33.0/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/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L769"}}),oo=new A({props:{name:"forward",anchor:"transformers.FalconModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[torch.Tensor, torch.Tensor], ...], NoneType] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",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.FalconModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0][0].shape[2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FalconModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_hidden_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.</p>
<p>Each element of <code>past_key_values</code> is a tuple (past_key, past_value):</p>
<ul>
<li>past_key: [batch_size * num_heads, head_dim, kv_length]</li>
<li>past_value: [batch_size * num_heads, kv_length, head_dim]</li>
</ul>`,name:"past_key_values"},{anchor:"transformers.FalconModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>`,name:"attention_mask"},{anchor:"transformers.FalconModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.FalconModel.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.FalconModel.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.FalconModel.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.FalconModel.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.FalconModel.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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L828",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</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/v4.33.0/en/model_doc/falcon#transformers.FalconConfig"
>FalconConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</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>) \u2014 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>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-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>) \u2014 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>) \u2014 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>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 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 of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ke=new et({props:{$$slots:{default:[Yl]},$$scope:{ctx:$}}}),Fe=new ot({props:{anchor:"transformers.FalconModel.forward.example",$$slots:{default:[Ll]},$$scope:{ctx:$}}}),to=new me({}),no=new A({props:{name:"class transformers.FalconForCausalLM",anchor:"transformers.FalconForCausalLM",parameters:[{name:"config",val:": FalconConfig"}],parametersDescription:[{anchor:"transformers.FalconForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconConfig">FalconConfig</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/v4.33.0/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/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L969"}}),lo=new A({props:{name:"forward",anchor:"transformers.FalconForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[torch.Tensor, torch.Tensor], ...], NoneType] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.FalconForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0][0].shape[2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FalconForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_hidden_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.</p>
<p>Each element of <code>past_key_values</code> is a tuple (past_key, past_value):</p>
<ul>
<li>past_key: [batch_size * num_heads, head_dim, kv_length]</li>
<li>past_value: [batch_size * num_heads, kv_length, head_dim]</li>
</ul>`,name:"past_key_values"},{anchor:"transformers.FalconForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>`,name:"attention_mask"},{anchor:"transformers.FalconForCausalLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.FalconForCausalLM.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.FalconForCausalLM.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.FalconForCausalLM.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.FalconForCausalLM.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.FalconForCausalLM.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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FalconForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set
<code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code>
are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L1003",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</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/v4.33.0/en/model_doc/falcon#transformers.FalconConfig"
>FalconConfig</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) \u2014 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>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 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>) \u2014 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>
<li>
<p><strong>cross_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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</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>) \u2014 Tuple of <code>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),$e=new et({props:{$$slots:{default:[Hl]},$$scope:{ctx:$}}}),Ce=new ot({props:{anchor:"transformers.FalconForCausalLM.forward.example",$$slots:{default:[Ol]},$$scope:{ctx:$}}}),io=new me({}),co=new A({props:{name:"class transformers.FalconForSequenceClassification",anchor:"transformers.FalconForSequenceClassification",parameters:[{name:"config",val:": FalconConfig"}],parametersDescription:[{anchor:"transformers.FalconForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconConfig">FalconConfig</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/v4.33.0/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/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L1110"}}),mo=new A({props:{name:"forward",anchor:"transformers.FalconForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[torch.Tensor, torch.Tensor], ...], NoneType] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.FalconForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0][0].shape[2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FalconForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_hidden_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.</p>
<p>Each element of <code>past_key_values</code> is a tuple (past_key, past_value):</p>
<ul>
<li>past_key: [batch_size * num_heads, head_dim, kv_length]</li>
<li>past_value: [batch_size * num_heads, kv_length, head_dim]</li>
</ul>`,name:"past_key_values"},{anchor:"transformers.FalconForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>`,name:"attention_mask"},{anchor:"transformers.FalconForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.FalconForSequenceClassification.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.FalconForSequenceClassification.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.FalconForSequenceClassification.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.FalconForSequenceClassification.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.FalconForSequenceClassification.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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FalconForSequenceClassification.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/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L1120",returnDescription:`
<p>A <code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> 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/v4.33.0/en/model_doc/falcon#transformers.FalconConfig"
>FalconConfig</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) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ee=new et({props:{$$slots:{default:[Dl]},$$scope:{ctx:$}}}),je=new ot({props:{anchor:"transformers.FalconForSequenceClassification.forward.example",$$slots:{default:[Kl]},$$scope:{ctx:$}}}),ze=new ot({props:{anchor:"transformers.FalconForSequenceClassification.forward.example-2",$$slots:{default:[ei]},$$scope:{ctx:$}}}),fo=new me({}),go=new A({props:{name:"class transformers.FalconForTokenClassification",anchor:"transformers.FalconForTokenClassification",parameters:[{name:"config",val:": FalconConfig"}],parametersDescription:[{anchor:"transformers.FalconForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconConfig">FalconConfig</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/v4.33.0/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/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L1226"}}),vo=new A({props:{name:"forward",anchor:"transformers.FalconForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Union[typing.Tuple[typing.Tuple[torch.Tensor, torch.Tensor], ...], NoneType] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = 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.FalconForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0][0].shape[2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FalconForTokenClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_hidden_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.</p>
<p>Each element of <code>past_key_values</code> is a tuple (past_key, past_value):</p>
<ul>
<li>past_key: [batch_size * num_heads, head_dim, kv_length]</li>
<li>past_value: [batch_size * num_heads, kv_length, head_dim]</li>
</ul>`,name:"past_key_values"},{anchor:"transformers.FalconForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>`,name:"attention_mask"},{anchor:"transformers.FalconForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.FalconForTokenClassification.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.FalconForTokenClassification.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.FalconForTokenClassification.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.FalconForTokenClassification.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.FalconForTokenClassification.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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FalconForTokenClassification.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/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L1244",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconConfig"
>FalconConfig</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)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 Classification scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.33.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xe=new et({props:{$$slots:{default:[oi]},$$scope:{ctx:$}}}),Ie=new ot({props:{anchor:"transformers.FalconForTokenClassification.forward.example",$$slots:{default:[ti]},$$scope:{ctx:$}}}),wo=new me({}),To=new A({props:{name:"class transformers.FalconForQuestionAnswering",anchor:"transformers.FalconForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FalconForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconConfig">FalconConfig</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/v4.33.0/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/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L1315"}}),$o=new A({props:{name:"forward",anchor:"transformers.FalconForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = 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.FalconForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
<code>input_ids_length</code> = <code>sequence_length</code> if <code>past_key_values</code> is <code>None</code> else <code>past_key_values[0][0].shape[2]</code>
(<code>sequence_length</code> of input past key value states). Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>past_key_values</code> is used, only <code>input_ids</code> that do not have their past calculated should be passed as
<code>input_ids</code>.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.33.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.33.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FalconForQuestionAnswering.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple[Tuple[torch.Tensor]]</code> of length <code>config.num_hidden_layers</code>) &#x2014;
Contains precomputed hidden-states (key and values in the attention blocks) as computed by the model (see
<code>past_key_values</code> output below). Can be used to speed up sequential decoding. The <code>input_ids</code> which have
their past given to this model should not be passed as <code>input_ids</code> as they have already been computed.</p>
<p>Each element of <code>past_key_values</code> is a tuple (past_key, past_value):</p>
<ul>
<li>past_key: [batch_size * num_heads, head_dim, kv_length]</li>
<li>past_value: [batch_size * num_heads, kv_length, head_dim]</li>
</ul>`,name:"past_key_values"},{anchor:"transformers.FalconForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</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>`,name:"attention_mask"},{anchor:"transformers.FalconForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</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:"head_mask"},{anchor:"transformers.FalconForQuestionAnswering.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.</p>
<p>If <code>past_key_values</code> is used, optionally only the last <code>inputs_embeds</code> have to be input (see
<code>past_key_values</code>).`,name:"inputs_embeds"},{anchor:"transformers.FalconForQuestionAnswering.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.FalconForQuestionAnswering.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.FalconForQuestionAnswering.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.FalconForQuestionAnswering.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/v4.33.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FalconForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.FalconForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.33.0/src/transformers/models/falcon/modeling_falcon.py#L1324"}}),Ze=new et({props:{$$slots:{default:[ni]},$$scope:{ctx:$}}}),{c(){c=r("meta"),y=m(),u=r("h1"),p=r("a"),_=r("span"),v(n.$$.fragment),d=m(),C=r("span"),Un=s("Falcon"),Qt=m(),O=r("h2"),fe=r("a"),st=r("span"),v(Ae.$$.fragment),xn=m(),at=r("span"),In=s("Overview"),Yt=m(),P=r("p"),Wn=s("Falcon is a class of causal decoder-only models built by "),Pe=r("a"),Zn=s("TII"),Nn=s(`. The largest Falcon checkpoints
have been trained on >=1T tokens of text, with a particular emphasis on the `),Be=r("a"),qn=s("RefinedWeb"),Rn=s(`
corpus. They are made available under the Apache 2.0 license.`),Lt=m(),ge=r("p"),Gn=s(`Falcon\u2019s architecture is modern and optimized for inference, with multi-query attention and support for efficient
attention variants like `),rt=r("code"),An=s("FlashAttention"),Pn=s(`. Both \u2018base\u2019 models trained only as causal language models as well as
\u2018instruct\u2019 models that have received further fine-tuning are available.`),Ht=m(),_e=r("p"),Bn=s(`Falcon models are (as of 2023) some of the largest and most powerful open-source language models,
and consistently rank highly in the `),Se=r("a"),Sn=s("OpenLLM leaderboard"),Vn=s("."),Ot=m(),D=r("h2"),be=r("a"),lt=r("span"),v(Ve.$$.fragment),Xn=m(),it=r("span"),Qn=s("Converting custom checkpoints"),Dt=m(),v(ye.$$.fragment),Kt=m(),x=r("p"),Yn=s("You can convert custom code checkpoints to full Transformers checkpoints using the "),ct=r("code"),Ln=s("convert_custom_code_checkpoint.py"),Hn=s(`
script located in the
`),Xe=r("a"),On=s("Falcon model directory"),Dn=s(`
of the Transformers library. To use this script, simply call it with
`),dt=r("code"),Kn=s("python convert_custom_code_checkpoint.py --checkpoint_dir my_model"),es=s(`. This will convert your checkpoint in-place, and
you can immediately load it from the directory afterwards with e.g. `),ht=r("code"),os=s("from_pretrained()"),ts=s(`. If your model hasn\u2019t been
uploaded to the Hub, we recommend making a backup before attempting the conversion, just in case!`),en=m(),K=r("h2"),ve=r("a"),pt=r("span"),v(Qe.$$.fragment),ns=m(),ut=r("span"),ss=s("FalconConfig"),on=m(),Z=r("div"),v(Ye.$$.fragment),as=m(),ee=r("p"),rs=s("This is the configuration class to store the configuration of a "),jo=r("a"),ls=s("FalconModel"),is=s(`. It is used to instantiate a Falcon
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
`),Le=r("a"),cs=s("tiiuae/falcon-7b"),ds=s(" architecture."),hs=m(),oe=r("p"),ps=s("Configuration objects inherit from "),zo=r("a"),us=s("PretrainedConfig"),ms=s(` and can be used to control the model outputs. Read the
documentation from `),Uo=r("a"),fs=s("PretrainedConfig"),gs=s(" for more information."),_s=m(),v(we.$$.fragment),tn=m(),te=r("h2"),Te=r("a"),mt=r("span"),v(He.$$.fragment),bs=m(),ft=r("span"),ys=s("FalconModel"),nn=m(),E=r("div"),v(Oe.$$.fragment),vs=m(),gt=r("p"),ws=s("The bare Falcon Model transformer outputting raw hidden-states without any specific head on top."),Ts=m(),De=r("p"),ks=s("This model inherits from "),xo=r("a"),Fs=s("PreTrainedModel"),Ms=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),$s=m(),Ke=r("p"),Cs=s("This model is also a PyTorch "),eo=r("a"),Js=s("torch.nn.Module"),Es=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),js=m(),q=r("div"),v(oo.$$.fragment),zs=m(),ne=r("p"),Us=s("The "),Io=r("a"),xs=s("FalconModel"),Is=s(" forward method, overrides the "),_t=r("code"),Ws=s("__call__"),Zs=s(" special method."),Ns=m(),v(ke.$$.fragment),qs=m(),v(Fe.$$.fragment),sn=m(),se=r("h2"),Me=r("a"),bt=r("span"),v(to.$$.fragment),Rs=m(),yt=r("span"),Gs=s("FalconForCausalLM"),an=m(),j=r("div"),v(no.$$.fragment),As=m(),vt=r("p"),Ps=s("The Falcon Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings)."),Bs=m(),so=r("p"),Ss=s("This model inherits from "),Wo=r("a"),Vs=s("PreTrainedModel"),Xs=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),Qs=m(),ao=r("p"),Ys=s("This model is also a PyTorch "),ro=r("a"),Ls=s("torch.nn.Module"),Hs=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Os=m(),R=r("div"),v(lo.$$.fragment),Ds=m(),ae=r("p"),Ks=s("The "),Zo=r("a"),ea=s("FalconForCausalLM"),oa=s(" forward method, overrides the "),wt=r("code"),ta=s("__call__"),na=s(" special method."),sa=m(),v($e.$$.fragment),aa=m(),v(Ce.$$.fragment),rn=m(),re=r("h2"),Je=r("a"),Tt=r("span"),v(io.$$.fragment),ra=m(),kt=r("span"),la=s("FalconForSequenceClassification"),ln=m(),J=r("div"),v(co.$$.fragment),ia=m(),Ft=r("p"),ca=s("The Falcon Model transformer with a sequence classification head on top (linear layer)."),da=m(),No=r("p"),qo=r("a"),ha=s("FalconForSequenceClassification"),pa=s(` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),ua=m(),N=r("p"),ma=s(`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Mt=r("code"),fa=s("pad_token_id"),ga=s(` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),$t=r("code"),_a=s("pad_token_id"),ba=s(` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ct=r("code"),ya=s("inputs_embeds"),va=s(" are passed instead of "),Jt=r("code"),wa=s("input_ids"),Ta=s(`, it does the same (take the last value in
each row of the batch).`),ka=m(),ho=r("p"),Fa=s("This model inherits from "),Ro=r("a"),Ma=s("PreTrainedModel"),$a=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),Ca=m(),po=r("p"),Ja=s("This model is also a PyTorch "),uo=r("a"),Ea=s("torch.nn.Module"),ja=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),za=m(),I=r("div"),v(mo.$$.fragment),Ua=m(),le=r("p"),xa=s("The "),Go=r("a"),Ia=s("FalconForSequenceClassification"),Wa=s(" forward method, overrides the "),Et=r("code"),Za=s("__call__"),Na=s(" special method."),qa=m(),v(Ee.$$.fragment),Ra=m(),v(je.$$.fragment),Ga=m(),v(ze.$$.fragment),cn=m(),ie=r("h2"),Ue=r("a"),jt=r("span"),v(fo.$$.fragment),Aa=m(),zt=r("span"),Pa=s("FalconForTokenClassification"),dn=m(),z=r("div"),v(go.$$.fragment),Ba=m(),Ut=r("p"),Sa=s(`Falcon Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.`),Va=m(),_o=r("p"),Xa=s("This model inherits from "),Ao=r("a"),Qa=s("PreTrainedModel"),Ya=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),La=m(),bo=r("p"),Ha=s("This model is also a PyTorch "),yo=r("a"),Oa=s("torch.nn.Module"),Da=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ka=m(),G=r("div"),v(vo.$$.fragment),er=m(),ce=r("p"),or=s("The "),Po=r("a"),tr=s("FalconForTokenClassification"),nr=s(" forward method, overrides the "),xt=r("code"),sr=s("__call__"),ar=s(" special method."),rr=m(),v(xe.$$.fragment),lr=m(),v(Ie.$$.fragment),hn=m(),de=r("h2"),We=r("a"),It=r("span"),v(wo.$$.fragment),ir=m(),Wt=r("span"),cr=s("FalconForQuestionAnswering"),pn=m(),U=r("div"),v(To.$$.fragment),dr=m(),he=r("p"),hr=s(`The Falcon Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),Zt=r("code"),pr=s("span start logits"),ur=s(" and "),Nt=r("code"),mr=s("span end logits"),fr=s(")."),gr=m(),ko=r("p"),_r=s("This model inherits from "),Bo=r("a"),br=s("PreTrainedModel"),yr=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),vr=m(),Fo=r("p"),wr=s("This model is also a PyTorch "),Mo=r("a"),Tr=s("torch.nn.Module"),kr=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Fr=m(),B=r("div"),v($o.$$.fragment),Mr=m(),pe=r("p"),$r=s("The "),So=r("a"),Cr=s("FalconForQuestionAnswering"),Jr=s(" forward method, overrides the "),qt=r("code"),Er=s("__call__"),jr=s(" special method."),zr=m(),v(Ze.$$.fragment),this.h()},l(o){const g=Sl('[data-svelte="svelte-1phssyn"]',document.head);c=l(g,"META",{name:!0,content:!0}),g.forEach(t),y=f(o),u=l(o,"H1",{class:!0});var Co=i(u);p=l(Co,"A",{id:!0,class:!0,href:!0});var Rt=i(p);_=l(Rt,"SPAN",{});var Gt=i(_);w(n.$$.fragment,Gt),Gt.forEach(t),Rt.forEach(t),d=f(Co),C=l(Co,"SPAN",{});var At=i(C);Un=a(At,"Falcon"),At.forEach(t),Co.forEach(t),Qt=f(o),O=l(o,"H2",{class:!0});var Jo=i(O);fe=l(Jo,"A",{id:!0,class:!0,href:!0});var Pt=i(fe);st=l(Pt,"SPAN",{});var Bt=i(st);w(Ae.$$.fragment,Bt),Bt.forEach(t),Pt.forEach(t),xn=f(Jo),at=l(Jo,"SPAN",{});var St=i(at);In=a(St,"Overview"),St.forEach(t),Jo.forEach(t),Yt=f(o),P=l(o,"P",{});var ue=i(P);Wn=a(ue,"Falcon is a class of causal decoder-only models built by "),Pe=l(ue,"A",{href:!0,rel:!0});var Vt=i(Pe);Zn=a(Vt,"TII"),Vt.forEach(t),Nn=a(ue,`. The largest Falcon checkpoints
have been trained on >=1T tokens of text, with a particular emphasis on the `),Be=l(ue,"A",{href:!0,rel:!0});var Xt=i(Be);qn=a(Xt,"RefinedWeb"),Xt.forEach(t),Rn=a(ue,`
corpus. They are made available under the Apache 2.0 license.`),ue.forEach(t),Lt=f(o),ge=l(o,"P",{});var Eo=i(ge);Gn=a(Eo,`Falcon\u2019s architecture is modern and optimized for inference, with multi-query attention and support for efficient
attention variants like `),rt=l(Eo,"CODE",{});var xr=i(rt);An=a(xr,"FlashAttention"),xr.forEach(t),Pn=a(Eo,`. Both \u2018base\u2019 models trained only as causal language models as well as
\u2018instruct\u2019 models that have received further fine-tuning are available.`),Eo.forEach(t),Ht=f(o),_e=l(o,"P",{});var mn=i(_e);Bn=a(mn,`Falcon models are (as of 2023) some of the largest and most powerful open-source language models,
and consistently rank highly in the `),Se=l(mn,"A",{href:!0,rel:!0});var Ir=i(Se);Sn=a(Ir,"OpenLLM leaderboard"),Ir.forEach(t),Vn=a(mn,"."),mn.forEach(t),Ot=f(o),D=l(o,"H2",{class:!0});var fn=i(D);be=l(fn,"A",{id:!0,class:!0,href:!0});var Wr=i(be);lt=l(Wr,"SPAN",{});var Zr=i(lt);w(Ve.$$.fragment,Zr),Zr.forEach(t),Wr.forEach(t),Xn=f(fn),it=l(fn,"SPAN",{});var Nr=i(it);Qn=a(Nr,"Converting custom checkpoints"),Nr.forEach(t),fn.forEach(t),Dt=f(o),w(ye.$$.fragment,o),Kt=f(o),x=l(o,"P",{});var S=i(x);Yn=a(S,"You can convert custom code checkpoints to full Transformers checkpoints using the "),ct=l(S,"CODE",{});var qr=i(ct);Ln=a(qr,"convert_custom_code_checkpoint.py"),qr.forEach(t),Hn=a(S,`
script located in the
`),Xe=l(S,"A",{href:!0,rel:!0});var Rr=i(Xe);On=a(Rr,"Falcon model directory"),Rr.forEach(t),Dn=a(S,`
of the Transformers library. To use this script, simply call it with
`),dt=l(S,"CODE",{});var Gr=i(dt);Kn=a(Gr,"python convert_custom_code_checkpoint.py --checkpoint_dir my_model"),Gr.forEach(t),es=a(S,`. This will convert your checkpoint in-place, and
you can immediately load it from the directory afterwards with e.g. `),ht=l(S,"CODE",{});var Ar=i(ht);os=a(Ar,"from_pretrained()"),Ar.forEach(t),ts=a(S,`. If your model hasn\u2019t been
uploaded to the Hub, we recommend making a backup before attempting the conversion, just in case!`),S.forEach(t),en=f(o),K=l(o,"H2",{class:!0});var gn=i(K);ve=l(gn,"A",{id:!0,class:!0,href:!0});var Pr=i(ve);pt=l(Pr,"SPAN",{});var Br=i(pt);w(Qe.$$.fragment,Br),Br.forEach(t),Pr.forEach(t),ns=f(gn),ut=l(gn,"SPAN",{});var Sr=i(ut);ss=a(Sr,"FalconConfig"),Sr.forEach(t),gn.forEach(t),on=f(o),Z=l(o,"DIV",{class:!0});var Ne=i(Z);w(Ye.$$.fragment,Ne),as=f(Ne),ee=l(Ne,"P",{});var Vo=i(ee);rs=a(Vo,"This is the configuration class to store the configuration of a "),jo=l(Vo,"A",{href:!0});var Vr=i(jo);ls=a(Vr,"FalconModel"),Vr.forEach(t),is=a(Vo,`. It is used to instantiate a Falcon
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
`),Le=l(Vo,"A",{href:!0,rel:!0});var Xr=i(Le);cs=a(Xr,"tiiuae/falcon-7b"),Xr.forEach(t),ds=a(Vo," architecture."),Vo.forEach(t),hs=f(Ne),oe=l(Ne,"P",{});var Xo=i(oe);ps=a(Xo,"Configuration objects inherit from "),zo=l(Xo,"A",{href:!0});var Qr=i(zo);us=a(Qr,"PretrainedConfig"),Qr.forEach(t),ms=a(Xo,` and can be used to control the model outputs. Read the
documentation from `),Uo=l(Xo,"A",{href:!0});var Yr=i(Uo);fs=a(Yr,"PretrainedConfig"),Yr.forEach(t),gs=a(Xo," for more information."),Xo.forEach(t),_s=f(Ne),w(we.$$.fragment,Ne),Ne.forEach(t),tn=f(o),te=l(o,"H2",{class:!0});var _n=i(te);Te=l(_n,"A",{id:!0,class:!0,href:!0});var Lr=i(Te);mt=l(Lr,"SPAN",{});var Hr=i(mt);w(He.$$.fragment,Hr),Hr.forEach(t),Lr.forEach(t),bs=f(_n),ft=l(_n,"SPAN",{});var Or=i(ft);ys=a(Or,"FalconModel"),Or.forEach(t),_n.forEach(t),nn=f(o),E=l(o,"DIV",{class:!0});var V=i(E);w(Oe.$$.fragment,V),vs=f(V),gt=l(V,"P",{});var Dr=i(gt);ws=a(Dr,"The bare Falcon Model transformer outputting raw hidden-states without any specific head on top."),Dr.forEach(t),Ts=f(V),De=l(V,"P",{});var bn=i(De);ks=a(bn,"This model inherits from "),xo=l(bn,"A",{href:!0});var Kr=i(xo);Fs=a(Kr,"PreTrainedModel"),Kr.forEach(t),Ms=a(bn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),bn.forEach(t),$s=f(V),Ke=l(V,"P",{});var yn=i(Ke);Cs=a(yn,"This model is also a PyTorch "),eo=l(yn,"A",{href:!0,rel:!0});var el=i(eo);Js=a(el,"torch.nn.Module"),el.forEach(t),Es=a(yn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yn.forEach(t),js=f(V),q=l(V,"DIV",{class:!0});var qe=i(q);w(oo.$$.fragment,qe),zs=f(qe),ne=l(qe,"P",{});var Qo=i(ne);Us=a(Qo,"The "),Io=l(Qo,"A",{href:!0});var ol=i(Io);xs=a(ol,"FalconModel"),ol.forEach(t),Is=a(Qo," forward method, overrides the "),_t=l(Qo,"CODE",{});var tl=i(_t);Ws=a(tl,"__call__"),tl.forEach(t),Zs=a(Qo," special method."),Qo.forEach(t),Ns=f(qe),w(ke.$$.fragment,qe),qs=f(qe),w(Fe.$$.fragment,qe),qe.forEach(t),V.forEach(t),sn=f(o),se=l(o,"H2",{class:!0});var vn=i(se);Me=l(vn,"A",{id:!0,class:!0,href:!0});var nl=i(Me);bt=l(nl,"SPAN",{});var sl=i(bt);w(to.$$.fragment,sl),sl.forEach(t),nl.forEach(t),Rs=f(vn),yt=l(vn,"SPAN",{});var al=i(yt);Gs=a(al,"FalconForCausalLM"),al.forEach(t),vn.forEach(t),an=f(o),j=l(o,"DIV",{class:!0});var X=i(j);w(no.$$.fragment,X),As=f(X),vt=l(X,"P",{});var rl=i(vt);Ps=a(rl,"The Falcon Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings)."),rl.forEach(t),Bs=f(X),so=l(X,"P",{});var wn=i(so);Ss=a(wn,"This model inherits from "),Wo=l(wn,"A",{href:!0});var ll=i(Wo);Vs=a(ll,"PreTrainedModel"),ll.forEach(t),Xs=a(wn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),wn.forEach(t),Qs=f(X),ao=l(X,"P",{});var Tn=i(ao);Ys=a(Tn,"This model is also a PyTorch "),ro=l(Tn,"A",{href:!0,rel:!0});var il=i(ro);Ls=a(il,"torch.nn.Module"),il.forEach(t),Hs=a(Tn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Tn.forEach(t),Os=f(X),R=l(X,"DIV",{class:!0});var Re=i(R);w(lo.$$.fragment,Re),Ds=f(Re),ae=l(Re,"P",{});var Yo=i(ae);Ks=a(Yo,"The "),Zo=l(Yo,"A",{href:!0});var cl=i(Zo);ea=a(cl,"FalconForCausalLM"),cl.forEach(t),oa=a(Yo," forward method, overrides the "),wt=l(Yo,"CODE",{});var dl=i(wt);ta=a(dl,"__call__"),dl.forEach(t),na=a(Yo," special method."),Yo.forEach(t),sa=f(Re),w($e.$$.fragment,Re),aa=f(Re),w(Ce.$$.fragment,Re),Re.forEach(t),X.forEach(t),rn=f(o),re=l(o,"H2",{class:!0});var kn=i(re);Je=l(kn,"A",{id:!0,class:!0,href:!0});var hl=i(Je);Tt=l(hl,"SPAN",{});var pl=i(Tt);w(io.$$.fragment,pl),pl.forEach(t),hl.forEach(t),ra=f(kn),kt=l(kn,"SPAN",{});var ul=i(kt);la=a(ul,"FalconForSequenceClassification"),ul.forEach(t),kn.forEach(t),ln=f(o),J=l(o,"DIV",{class:!0});var W=i(J);w(co.$$.fragment,W),ia=f(W),Ft=l(W,"P",{});var ml=i(Ft);ca=a(ml,"The Falcon Model transformer with a sequence classification head on top (linear layer)."),ml.forEach(t),da=f(W),No=l(W,"P",{});var Ur=i(No);qo=l(Ur,"A",{href:!0});var fl=i(qo);ha=a(fl,"FalconForSequenceClassification"),fl.forEach(t),pa=a(Ur,` uses the last token in order to do the classification, as other causal models
(e.g. GPT-1) do.`),Ur.forEach(t),ua=f(W),N=l(W,"P",{});var Q=i(N);ma=a(Q,`Since it does classification on the last token, it requires to know the position of the last token. If a
`),Mt=l(Q,"CODE",{});var gl=i(Mt);fa=a(gl,"pad_token_id"),gl.forEach(t),ga=a(Q,` is defined in the configuration, it finds the last token that is not a padding token in each row. If
no `),$t=l(Q,"CODE",{});var _l=i($t);_a=a(_l,"pad_token_id"),_l.forEach(t),ba=a(Q,` is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when `),Ct=l(Q,"CODE",{});var bl=i(Ct);ya=a(bl,"inputs_embeds"),bl.forEach(t),va=a(Q," are passed instead of "),Jt=l(Q,"CODE",{});var yl=i(Jt);wa=a(yl,"input_ids"),yl.forEach(t),Ta=a(Q,`, it does the same (take the last value in
each row of the batch).`),Q.forEach(t),ka=f(W),ho=l(W,"P",{});var Fn=i(ho);Fa=a(Fn,"This model inherits from "),Ro=l(Fn,"A",{href:!0});var vl=i(Ro);Ma=a(vl,"PreTrainedModel"),vl.forEach(t),$a=a(Fn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),Fn.forEach(t),Ca=f(W),po=l(W,"P",{});var Mn=i(po);Ja=a(Mn,"This model is also a PyTorch "),uo=l(Mn,"A",{href:!0,rel:!0});var wl=i(uo);Ea=a(wl,"torch.nn.Module"),wl.forEach(t),ja=a(Mn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Mn.forEach(t),za=f(W),I=l(W,"DIV",{class:!0});var Y=i(I);w(mo.$$.fragment,Y),Ua=f(Y),le=l(Y,"P",{});var Lo=i(le);xa=a(Lo,"The "),Go=l(Lo,"A",{href:!0});var Tl=i(Go);Ia=a(Tl,"FalconForSequenceClassification"),Tl.forEach(t),Wa=a(Lo," forward method, overrides the "),Et=l(Lo,"CODE",{});var kl=i(Et);Za=a(kl,"__call__"),kl.forEach(t),Na=a(Lo," special method."),Lo.forEach(t),qa=f(Y),w(Ee.$$.fragment,Y),Ra=f(Y),w(je.$$.fragment,Y),Ga=f(Y),w(ze.$$.fragment,Y),Y.forEach(t),W.forEach(t),cn=f(o),ie=l(o,"H2",{class:!0});var $n=i(ie);Ue=l($n,"A",{id:!0,class:!0,href:!0});var Fl=i(Ue);jt=l(Fl,"SPAN",{});var Ml=i(jt);w(fo.$$.fragment,Ml),Ml.forEach(t),Fl.forEach(t),Aa=f($n),zt=l($n,"SPAN",{});var $l=i(zt);Pa=a($l,"FalconForTokenClassification"),$l.forEach(t),$n.forEach(t),dn=f(o),z=l(o,"DIV",{class:!0});var L=i(z);w(go.$$.fragment,L),Ba=f(L),Ut=l(L,"P",{});var Cl=i(Ut);Sa=a(Cl,`Falcon Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. for
Named-Entity-Recognition (NER) tasks.`),Cl.forEach(t),Va=f(L),_o=l(L,"P",{});var Cn=i(_o);Xa=a(Cn,"This model inherits from "),Ao=l(Cn,"A",{href:!0});var Jl=i(Ao);Qa=a(Jl,"PreTrainedModel"),Jl.forEach(t),Ya=a(Cn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),Cn.forEach(t),La=f(L),bo=l(L,"P",{});var Jn=i(bo);Ha=a(Jn,"This model is also a PyTorch "),yo=l(Jn,"A",{href:!0,rel:!0});var El=i(yo);Oa=a(El,"torch.nn.Module"),El.forEach(t),Da=a(Jn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Jn.forEach(t),Ka=f(L),G=l(L,"DIV",{class:!0});var Ge=i(G);w(vo.$$.fragment,Ge),er=f(Ge),ce=l(Ge,"P",{});var Ho=i(ce);or=a(Ho,"The "),Po=l(Ho,"A",{href:!0});var jl=i(Po);tr=a(jl,"FalconForTokenClassification"),jl.forEach(t),nr=a(Ho," forward method, overrides the "),xt=l(Ho,"CODE",{});var zl=i(xt);sr=a(zl,"__call__"),zl.forEach(t),ar=a(Ho," special method."),Ho.forEach(t),rr=f(Ge),w(xe.$$.fragment,Ge),lr=f(Ge),w(Ie.$$.fragment,Ge),Ge.forEach(t),L.forEach(t),hn=f(o),de=l(o,"H2",{class:!0});var En=i(de);We=l(En,"A",{id:!0,class:!0,href:!0});var Ul=i(We);It=l(Ul,"SPAN",{});var xl=i(It);w(wo.$$.fragment,xl),xl.forEach(t),Ul.forEach(t),ir=f(En),Wt=l(En,"SPAN",{});var Il=i(Wt);cr=a(Il,"FalconForQuestionAnswering"),Il.forEach(t),En.forEach(t),pn=f(o),U=l(o,"DIV",{class:!0});var H=i(U);w(To.$$.fragment,H),dr=f(H),he=l(H,"P",{});var Oo=i(he);hr=a(Oo,`The Falcon Model transformer with a span classification head on top for extractive question-answering tasks like
SQuAD (a linear layers on top of the hidden-states output to compute `),Zt=l(Oo,"CODE",{});var Wl=i(Zt);pr=a(Wl,"span start logits"),Wl.forEach(t),ur=a(Oo," and "),Nt=l(Oo,"CODE",{});var Zl=i(Nt);mr=a(Zl,"span end logits"),Zl.forEach(t),fr=a(Oo,")."),Oo.forEach(t),gr=f(H),ko=l(H,"P",{});var jn=i(ko);_r=a(jn,"This model inherits from "),Bo=l(jn,"A",{href:!0});var Nl=i(Bo);br=a(Nl,"PreTrainedModel"),Nl.forEach(t),yr=a(jn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings etc.)`),jn.forEach(t),vr=f(H),Fo=l(H,"P",{});var zn=i(Fo);wr=a(zn,"This model is also a PyTorch "),Mo=l(zn,"A",{href:!0,rel:!0});var ql=i(Mo);Tr=a(ql,"torch.nn.Module"),ql.forEach(t),kr=a(zn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),zn.forEach(t),Fr=f(H),B=l(H,"DIV",{class:!0});var Do=i(B);w($o.$$.fragment,Do),Mr=f(Do),pe=l(Do,"P",{});var Ko=i(pe);$r=a(Ko,"The "),So=l(Ko,"A",{href:!0});var Rl=i(So);Cr=a(Rl,"FalconForQuestionAnswering"),Rl.forEach(t),Jr=a(Ko," forward method, overrides the "),qt=l(Ko,"CODE",{});var Gl=i(qt);Er=a(Gl,"__call__"),Gl.forEach(t),jr=a(Ko," special method."),Ko.forEach(t),zr=f(Do),w(Ze.$$.fragment,Do),Do.forEach(t),H.forEach(t),this.h()},h(){h(c,"name","hf:doc:metadata"),h(c,"content",JSON.stringify(ai)),h(p,"id","falcon"),h(p,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(p,"href","#falcon"),h(u,"class","relative group"),h(fe,"id","overview"),h(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(fe,"href","#overview"),h(O,"class","relative group"),h(Pe,"href","https://www.tii.ae/"),h(Pe,"rel","nofollow"),h(Be,"href","https://arxiv.org/abs/2306.01116"),h(Be,"rel","nofollow"),h(Se,"href","https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard"),h(Se,"rel","nofollow"),h(be,"id","converting-custom-checkpoints"),h(be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(be,"href","#converting-custom-checkpoints"),h(D,"class","relative group"),h(Xe,"href","https://github.com/huggingface/transformers/tree/main/src/transformers/models/falcon"),h(Xe,"rel","nofollow"),h(ve,"id","transformers.FalconConfig"),h(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ve,"href","#transformers.FalconConfig"),h(K,"class","relative group"),h(jo,"href","/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconModel"),h(Le,"href","https://huggingface.co/tiiuae/falcon-7b"),h(Le,"rel","nofollow"),h(zo,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Uo,"href","/docs/transformers/v4.33.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Te,"id","transformers.FalconModel"),h(Te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Te,"href","#transformers.FalconModel"),h(te,"class","relative group"),h(xo,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel"),h(eo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(eo,"rel","nofollow"),h(Io,"href","/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconModel"),h(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Me,"id","transformers.FalconForCausalLM"),h(Me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Me,"href","#transformers.FalconForCausalLM"),h(se,"class","relative group"),h(Wo,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel"),h(ro,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(ro,"rel","nofollow"),h(Zo,"href","/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconForCausalLM"),h(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Je,"id","transformers.FalconForSequenceClassification"),h(Je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Je,"href","#transformers.FalconForSequenceClassification"),h(re,"class","relative group"),h(qo,"href","/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconForSequenceClassification"),h(Ro,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel"),h(uo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(uo,"rel","nofollow"),h(Go,"href","/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconForSequenceClassification"),h(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ue,"id","transformers.FalconForTokenClassification"),h(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ue,"href","#transformers.FalconForTokenClassification"),h(ie,"class","relative group"),h(Ao,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel"),h(yo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(yo,"rel","nofollow"),h(Po,"href","/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconForTokenClassification"),h(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(We,"id","transformers.FalconForQuestionAnswering"),h(We,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(We,"href","#transformers.FalconForQuestionAnswering"),h(de,"class","relative group"),h(Bo,"href","/docs/transformers/v4.33.0/en/main_classes/model#transformers.PreTrainedModel"),h(Mo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Mo,"rel","nofollow"),h(So,"href","/docs/transformers/v4.33.0/en/model_doc/falcon#transformers.FalconForQuestionAnswering"),h(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,g){e(document.head,c),b(o,y,g),b(o,u,g),e(u,p),e(p,_),T(n,_,null),e(u,d),e(u,C),e(C,Un),b(o,Qt,g),b(o,O,g),e(O,fe),e(fe,st),T(Ae,st,null),e(O,xn),e(O,at),e(at,In),b(o,Yt,g),b(o,P,g),e(P,Wn),e(P,Pe),e(Pe,Zn),e(P,Nn),e(P,Be),e(Be,qn),e(P,Rn),b(o,Lt,g),b(o,ge,g),e(ge,Gn),e(ge,rt),e(rt,An),e(ge,Pn),b(o,Ht,g),b(o,_e,g),e(_e,Bn),e(_e,Se),e(Se,Sn),e(_e,Vn),b(o,Ot,g),b(o,D,g),e(D,be),e(be,lt),T(Ve,lt,null),e(D,Xn),e(D,it),e(it,Qn),b(o,Dt,g),T(ye,o,g),b(o,Kt,g),b(o,x,g),e(x,Yn),e(x,ct),e(ct,Ln),e(x,Hn),e(x,Xe),e(Xe,On),e(x,Dn),e(x,dt),e(dt,Kn),e(x,es),e(x,ht),e(ht,os),e(x,ts),b(o,en,g),b(o,K,g),e(K,ve),e(ve,pt),T(Qe,pt,null),e(K,ns),e(K,ut),e(ut,ss),b(o,on,g),b(o,Z,g),T(Ye,Z,null),e(Z,as),e(Z,ee),e(ee,rs),e(ee,jo),e(jo,ls),e(ee,is),e(ee,Le),e(Le,cs),e(ee,ds),e(Z,hs),e(Z,oe),e(oe,ps),e(oe,zo),e(zo,us),e(oe,ms),e(oe,Uo),e(Uo,fs),e(oe,gs),e(Z,_s),T(we,Z,null),b(o,tn,g),b(o,te,g),e(te,Te),e(Te,mt),T(He,mt,null),e(te,bs),e(te,ft),e(ft,ys),b(o,nn,g),b(o,E,g),T(Oe,E,null),e(E,vs),e(E,gt),e(gt,ws),e(E,Ts),e(E,De),e(De,ks),e(De,xo),e(xo,Fs),e(De,Ms),e(E,$s),e(E,Ke),e(Ke,Cs),e(Ke,eo),e(eo,Js),e(Ke,Es),e(E,js),e(E,q),T(oo,q,null),e(q,zs),e(q,ne),e(ne,Us),e(ne,Io),e(Io,xs),e(ne,Is),e(ne,_t),e(_t,Ws),e(ne,Zs),e(q,Ns),T(ke,q,null),e(q,qs),T(Fe,q,null),b(o,sn,g),b(o,se,g),e(se,Me),e(Me,bt),T(to,bt,null),e(se,Rs),e(se,yt),e(yt,Gs),b(o,an,g),b(o,j,g),T(no,j,null),e(j,As),e(j,vt),e(vt,Ps),e(j,Bs),e(j,so),e(so,Ss),e(so,Wo),e(Wo,Vs),e(so,Xs),e(j,Qs),e(j,ao),e(ao,Ys),e(ao,ro),e(ro,Ls),e(ao,Hs),e(j,Os),e(j,R),T(lo,R,null),e(R,Ds),e(R,ae),e(ae,Ks),e(ae,Zo),e(Zo,ea),e(ae,oa),e(ae,wt),e(wt,ta),e(ae,na),e(R,sa),T($e,R,null),e(R,aa),T(Ce,R,null),b(o,rn,g),b(o,re,g),e(re,Je),e(Je,Tt),T(io,Tt,null),e(re,ra),e(re,kt),e(kt,la),b(o,ln,g),b(o,J,g),T(co,J,null),e(J,ia),e(J,Ft),e(Ft,ca),e(J,da),e(J,No),e(No,qo),e(qo,ha),e(No,pa),e(J,ua),e(J,N),e(N,ma),e(N,Mt),e(Mt,fa),e(N,ga),e(N,$t),e($t,_a),e(N,ba),e(N,Ct),e(Ct,ya),e(N,va),e(N,Jt),e(Jt,wa),e(N,Ta),e(J,ka),e(J,ho),e(ho,Fa),e(ho,Ro),e(Ro,Ma),e(ho,$a),e(J,Ca),e(J,po),e(po,Ja),e(po,uo),e(uo,Ea),e(po,ja),e(J,za),e(J,I),T(mo,I,null),e(I,Ua),e(I,le),e(le,xa),e(le,Go),e(Go,Ia),e(le,Wa),e(le,Et),e(Et,Za),e(le,Na),e(I,qa),T(Ee,I,null),e(I,Ra),T(je,I,null),e(I,Ga),T(ze,I,null),b(o,cn,g),b(o,ie,g),e(ie,Ue),e(Ue,jt),T(fo,jt,null),e(ie,Aa),e(ie,zt),e(zt,Pa),b(o,dn,g),b(o,z,g),T(go,z,null),e(z,Ba),e(z,Ut),e(Ut,Sa),e(z,Va),e(z,_o),e(_o,Xa),e(_o,Ao),e(Ao,Qa),e(_o,Ya),e(z,La),e(z,bo),e(bo,Ha),e(bo,yo),e(yo,Oa),e(bo,Da),e(z,Ka),e(z,G),T(vo,G,null),e(G,er),e(G,ce),e(ce,or),e(ce,Po),e(Po,tr),e(ce,nr),e(ce,xt),e(xt,sr),e(ce,ar),e(G,rr),T(xe,G,null),e(G,lr),T(Ie,G,null),b(o,hn,g),b(o,de,g),e(de,We),e(We,It),T(wo,It,null),e(de,ir),e(de,Wt),e(Wt,cr),b(o,pn,g),b(o,U,g),T(To,U,null),e(U,dr),e(U,he),e(he,hr),e(he,Zt),e(Zt,pr),e(he,ur),e(he,Nt),e(Nt,mr),e(he,fr),e(U,gr),e(U,ko),e(ko,_r),e(ko,Bo),e(Bo,br),e(ko,yr),e(U,vr),e(U,Fo),e(Fo,wr),e(Fo,Mo),e(Mo,Tr),e(Fo,kr),e(U,Fr),e(U,B),T($o,B,null),e(B,Mr),e(B,pe),e(pe,$r),e(pe,So),e(So,Cr),e(pe,Jr),e(pe,qt),e(qt,Er),e(pe,jr),e(B,zr),T(Ze,B,null),un=!0},p(o,[g]){const Co={};g&2&&(Co.$$scope={dirty:g,ctx:o}),ye.$set(Co);const Rt={};g&2&&(Rt.$$scope={dirty:g,ctx:o}),we.$set(Rt);const Gt={};g&2&&(Gt.$$scope={dirty:g,ctx:o}),ke.$set(Gt);const At={};g&2&&(At.$$scope={dirty:g,ctx:o}),Fe.$set(At);const Jo={};g&2&&(Jo.$$scope={dirty:g,ctx:o}),$e.$set(Jo);const Pt={};g&2&&(Pt.$$scope={dirty:g,ctx:o}),Ce.$set(Pt);const Bt={};g&2&&(Bt.$$scope={dirty:g,ctx:o}),Ee.$set(Bt);const St={};g&2&&(St.$$scope={dirty:g,ctx:o}),je.$set(St);const ue={};g&2&&(ue.$$scope={dirty:g,ctx:o}),ze.$set(ue);const Vt={};g&2&&(Vt.$$scope={dirty:g,ctx:o}),xe.$set(Vt);const Xt={};g&2&&(Xt.$$scope={dirty:g,ctx:o}),Ie.$set(Xt);const Eo={};g&2&&(Eo.$$scope={dirty:g,ctx:o}),Ze.$set(Eo)},i(o){un||(k(n.$$.fragment,o),k(Ae.$$.fragment,o),k(Ve.$$.fragment,o),k(ye.$$.fragment,o),k(Qe.$$.fragment,o),k(Ye.$$.fragment,o),k(we.$$.fragment,o),k(He.$$.fragment,o),k(Oe.$$.fragment,o),k(oo.$$.fragment,o),k(ke.$$.fragment,o),k(Fe.$$.fragment,o),k(to.$$.fragment,o),k(no.$$.fragment,o),k(lo.$$.fragment,o),k($e.$$.fragment,o),k(Ce.$$.fragment,o),k(io.$$.fragment,o),k(co.$$.fragment,o),k(mo.$$.fragment,o),k(Ee.$$.fragment,o),k(je.$$.fragment,o),k(ze.$$.fragment,o),k(fo.$$.fragment,o),k(go.$$.fragment,o),k(vo.$$.fragment,o),k(xe.$$.fragment,o),k(Ie.$$.fragment,o),k(wo.$$.fragment,o),k(To.$$.fragment,o),k($o.$$.fragment,o),k(Ze.$$.fragment,o),un=!0)},o(o){F(n.$$.fragment,o),F(Ae.$$.fragment,o),F(Ve.$$.fragment,o),F(ye.$$.fragment,o),F(Qe.$$.fragment,o),F(Ye.$$.fragment,o),F(we.$$.fragment,o),F(He.$$.fragment,o),F(Oe.$$.fragment,o),F(oo.$$.fragment,o),F(ke.$$.fragment,o),F(Fe.$$.fragment,o),F(to.$$.fragment,o),F(no.$$.fragment,o),F(lo.$$.fragment,o),F($e.$$.fragment,o),F(Ce.$$.fragment,o),F(io.$$.fragment,o),F(co.$$.fragment,o),F(mo.$$.fragment,o),F(Ee.$$.fragment,o),F(je.$$.fragment,o),F(ze.$$.fragment,o),F(fo.$$.fragment,o),F(go.$$.fragment,o),F(vo.$$.fragment,o),F(xe.$$.fragment,o),F(Ie.$$.fragment,o),F(wo.$$.fragment,o),F(To.$$.fragment,o),F($o.$$.fragment,o),F(Ze.$$.fragment,o),un=!1},d(o){t(c),o&&t(y),o&&t(u),M(n),o&&t(Qt),o&&t(O),M(Ae),o&&t(Yt),o&&t(P),o&&t(Lt),o&&t(ge),o&&t(Ht),o&&t(_e),o&&t(Ot),o&&t(D),M(Ve),o&&t(Dt),M(ye,o),o&&t(Kt),o&&t(x),o&&t(en),o&&t(K),M(Qe),o&&t(on),o&&t(Z),M(Ye),M(we),o&&t(tn),o&&t(te),M(He),o&&t(nn),o&&t(E),M(Oe),M(oo),M(ke),M(Fe),o&&t(sn),o&&t(se),M(to),o&&t(an),o&&t(j),M(no),M(lo),M($e),M(Ce),o&&t(rn),o&&t(re),M(io),o&&t(ln),o&&t(J),M(co),M(mo),M(Ee),M(je),M(ze),o&&t(cn),o&&t(ie),M(fo),o&&t(dn),o&&t(z),M(go),M(vo),M(xe),M(Ie),o&&t(hn),o&&t(de),M(wo),o&&t(pn),o&&t(U),M(To),M($o),M(Ze)}}}const ai={local:"falcon",sections:[{local:"overview",title:"Overview"},{local:"converting-custom-checkpoints",title:"Converting custom checkpoints "},{local:"transformers.FalconConfig",title:"FalconConfig"},{local:"transformers.FalconModel",title:"FalconModel"},{local:"transformers.FalconForCausalLM",title:"FalconForCausalLM"},{local:"transformers.FalconForSequenceClassification",title:"FalconForSequenceClassification"},{local:"transformers.FalconForTokenClassification",title:"FalconForTokenClassification"},{local:"transformers.FalconForQuestionAnswering",title:"FalconForQuestionAnswering"}],title:"Falcon"};function ri($){return Vl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ui extends Al{constructor(c){super();Pl(this,c,ri,si,Bl,{})}}export{ui as default,ai as metadata};
