import{s as yt,o as Tt,n as B}from"../chunks/scheduler.01eeda35.js";import{S as wt,i as $t,g as u,s as c,r as g,A as Jt,h,f as s,c as d,j as se,x as $,u as b,k as re,l as vt,y as f,a as m,v as _,d as M,t as y,w as T}from"../chunks/index.6dd51b66.js";import{T as tt}from"../chunks/Tip.de9bae2b.js";import{D as ye}from"../chunks/Docstring.cb556860.js";import{C as le}from"../chunks/CodeBlock.19ec9b8c.js";import{E as at}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as Ge,E as Ft}from"../chunks/index.58fe8f9d.js";import{H as Ct,a as nt}from"../chunks/HfOption.f7f04550.js";function jt(w){let t,i="Click on the FalconMamba models in the right sidebar for more examples of how to apply FalconMamba to different language tasks.";return{c(){t=u("p"),t.textContent=i},l(a){t=h(a,"P",{"data-svelte-h":!0}),$(t)!=="svelte-eg9y95"&&(t.textContent=i)},m(a,r){m(a,t,r)},p:B,d(a){a&&s(t)}}}function kt(w){let t,i;return t=new le({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMCUyMnRleHQtZ2VuZXJhdGlvbiUyMiUyQyUyMCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEJTIydGlpdWFlJTJGZmFsY29uLW1hbWJhLTdiLWluc3RydWN0JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMGRldmljZSUzRDAlMEEpJTBBcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwJTIyRXhwbGFpbiUyMHRoZSUyMGRpZmZlcmVuY2UlMjBiZXR3ZWVuJTIwdHJhbnNmb3JtZXJzJTIwYW5kJTIwU1NNcyUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF9sZW5ndGglM0QxMDAlMkMlMEElMjAlMjAlMjAlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwdGVtcGVyYXR1cmUlM0QwLjclMEEp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipeline = pipeline(
    <span class="hljs-string">&quot;text-generation&quot;</span>, 
    model=<span class="hljs-string">&quot;tiiuae/falcon-mamba-7b-instruct&quot;</span>,
    torch_dtype=torch.bfloat16,
    device=<span class="hljs-number">0</span>
)
pipeline(
    <span class="hljs-string">&quot;Explain the difference between transformers and SSMs&quot;</span>,
    max_length=<span class="hljs-number">100</span>,
    do_sample=<span class="hljs-literal">True</span>,
    temperature=<span class="hljs-number">0.7</span>
)`,wrap:!1}}),{c(){g(t.$$.fragment)},l(a){b(t.$$.fragment,a)},m(a,r){_(t,a,r),i=!0},p:B,i(a){i||(M(t.$$.fragment,a),i=!0)},o(a){y(t.$$.fragment,a),i=!1},d(a){T(t,a)}}}function Ut(w){let t,i;return t=new le({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydGlpdWFlJTJGZmFsY29uLW1hbWJhLTdiLWluc3RydWN0JTIyKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnRpaXVhZSUyRmZhbGNvbi1tYW1iYS03Yi1pbnN0cnVjdCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUwQSklMEElMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyRXhwbGFpbiUyMHRoZSUyMGRpZmZlcmVuY2UlMjBiZXR3ZWVuJTIwdHJhbnNmb3JtZXJzJTIwYW5kJTIwU1NNcyUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKCUyMmN1ZGElMjIpJTBBJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoKippbnB1dF9pZHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDEwMCUyQyUyMGNhY2hlX2ltcGxlbWVudGF0aW9uJTNEJTIyc3RhdGljJTIyKSUwQXByaW50KHRva2VuaXplci5kZWNvZGUob3V0cHV0JTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;tiiuae/falcon-mamba-7b-instruct&quot;</span>)
model = AutoModelForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;tiiuae/falcon-mamba-7b-instruct&quot;</span>,
    torch_dtype=torch.bfloat16,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>
)

input_ids = tokenizer(<span class="hljs-string">&quot;Explain the difference between transformers and SSMs&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)

output = model.generate(**input_ids, max_new_tokens=<span class="hljs-number">100</span>, cache_implementation=<span class="hljs-string">&quot;static&quot;</span>)
<span class="hljs-built_in">print</span>(tokenizer.decode(output[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))`,wrap:!1}}),{c(){g(t.$$.fragment)},l(a){b(t.$$.fragment,a)},m(a,r){_(t,a,r),i=!0},p:B,i(a){i||(M(t.$$.fragment,a),i=!0)},o(a){y(t.$$.fragment,a),i=!1},d(a){T(t,a)}}}function xt(w){let t,i;return t=new le({props:{code:"dHJhbnNmb3JtZXJzLWNsaSUyMGNoYXQlMjAtLW1vZGVsX25hbWVfb3JfcGF0aCUyMHRpaXVhZSUyRmZhbGNvbi1tYW1iYS03Yi1pbnN0cnVjdCUyMC0tdG9yY2hfZHR5cGUlMjBhdXRvJTIwLS1kZXZpY2UlMjAw",highlighted:"transformers-cli chat --model_name_or_path tiiuae/falcon-mamba-7b-instruct --torch_dtype auto --device 0",wrap:!1}}),{c(){g(t.$$.fragment)},l(a){b(t.$$.fragment,a)},m(a,r){_(t,a,r),i=!0},p:B,i(a){i||(M(t.$$.fragment,a),i=!0)},o(a){y(t.$$.fragment,a),i=!1},d(a){T(t,a)}}}function It(w){let t,i,a,r,p,o;return t=new nt({props:{id:"usage",option:"Pipeline",$$slots:{default:[kt]},$$scope:{ctx:w}}}),a=new nt({props:{id:"usage",option:"AutoModel",$$slots:{default:[Ut]},$$scope:{ctx:w}}}),p=new nt({props:{id:"usage",option:"transformers-cli",$$slots:{default:[xt]},$$scope:{ctx:w}}}),{c(){g(t.$$.fragment),i=c(),g(a.$$.fragment),r=c(),g(p.$$.fragment)},l(l){b(t.$$.fragment,l),i=d(l),b(a.$$.fragment,l),r=d(l),b(p.$$.fragment,l)},m(l,J){_(t,l,J),m(l,i,J),_(a,l,J),m(l,r,J),_(p,l,J),o=!0},p(l,J){const V={};J&2&&(V.$$scope={dirty:J,ctx:l}),t.$set(V);const Z={};J&2&&(Z.$$scope={dirty:J,ctx:l}),a.$set(Z);const _e={};J&2&&(_e.$$scope={dirty:J,ctx:l}),p.$set(_e)},i(l){o||(M(t.$$.fragment,l),M(a.$$.fragment,l),M(p.$$.fragment,l),o=!0)},o(l){y(t.$$.fragment,l),y(a.$$.fragment,l),y(p.$$.fragment,l),o=!1},d(l){l&&(s(i),s(r)),T(t,l),T(a,l),T(p,l)}}}function Wt(w){let t,i="Example:",a,r,p;return r=new le({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZhbGNvbk1hbWJhQ29uZmlnJTJDJTIwRmFsY29uTWFtYmFNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBGYWxjb25NYW1iYSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwRmFsY29uTWFtYmFDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwRmFsY29uTWFtYmFNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FalconMambaConfig, FalconMambaModel

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){t=u("p"),t.textContent=i,a=c(),g(r.$$.fragment)},l(o){t=h(o,"P",{"data-svelte-h":!0}),$(t)!=="svelte-11lpom8"&&(t.textContent=i),a=d(o),b(r.$$.fragment,o)},m(o,l){m(o,t,l),m(o,a,l),_(r,o,l),p=!0},p:B,i(o){p||(M(r.$$.fragment,o),p=!0)},o(o){y(r.$$.fragment,o),p=!1},d(o){o&&(s(t),s(a)),T(r,o)}}}function zt(w){let t,i=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=u("p"),t.innerHTML=i},l(a){t=h(a,"P",{"data-svelte-h":!0}),$(t)!=="svelte-fincs2"&&(t.innerHTML=i)},m(a,r){m(a,t,r)},p:B,d(a){a&&s(t)}}}function Zt(w){let t,i="Example:",a,r,p;return r=new le({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGYWxjb25NYW1iYU1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ0aWl1YWUlMkZmYWxjb24tbWFtYmEtN2IlMjIpJTBBbW9kZWwlMjAlM0QlMjBGYWxjb25NYW1iYU1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJ0aWl1YWUlMkZmYWxjb24tbWFtYmEtN2IlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FalconMambaModel
<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;tiiuae/falcon-mamba-7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconMambaModel.from_pretrained(<span class="hljs-string">&quot;tiiuae/falcon-mamba-7b&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`,wrap:!1}}),{c(){t=u("p"),t.textContent=i,a=c(),g(r.$$.fragment)},l(o){t=h(o,"P",{"data-svelte-h":!0}),$(t)!=="svelte-11lpom8"&&(t.textContent=i),a=d(o),b(r.$$.fragment,o)},m(o,l){m(o,t,l),m(o,a,l),_(r,o,l),p=!0},p:B,i(o){p||(M(r.$$.fragment,o),p=!0)},o(o){y(r.$$.fragment,o),p=!1},d(o){o&&(s(t),s(a)),T(r,o)}}}function Bt(w){let t,i=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=u("p"),t.innerHTML=i},l(a){t=h(a,"P",{"data-svelte-h":!0}),$(t)!=="svelte-fincs2"&&(t.innerHTML=i)},m(a,r){m(a,t,r)},p:B,d(a){a&&s(t)}}}function Gt(w){let t,i="Example:",a,r,p;return r=new le({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEZhbGNvbk1hbWJhRm9yQ2F1c2FsTE0lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ0aWl1YWUlMkZmYWxjb24tbWFtYmEtN2IlMjIpJTBBbW9kZWwlMjAlM0QlMjBGYWxjb25NYW1iYUZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJ0aWl1YWUlMkZmYWxjb24tbWFtYmEtN2IlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGlucHV0cyU1QiUyMmlucHV0X2lkcyUyMiU1RCklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",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, FalconMambaForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;tiiuae/falcon-mamba-7b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FalconMambaForCausalLM.from_pretrained(<span class="hljs-string">&quot;tiiuae/falcon-mamba-7b&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`,wrap:!1}}),{c(){t=u("p"),t.textContent=i,a=c(),g(r.$$.fragment)},l(o){t=h(o,"P",{"data-svelte-h":!0}),$(t)!=="svelte-11lpom8"&&(t.textContent=i),a=d(o),b(r.$$.fragment,o)},m(o,l){m(o,t,l),m(o,a,l),_(r,o,l),p=!0},p:B,i(o){p||(M(r.$$.fragment,o),p=!0)},o(o){y(r.$$.fragment,o),p=!1},d(o){o&&(s(t),s(a)),T(r,o)}}}function Rt(w){let t,i,a,r,p,o='<div class="flex flex-wrap space-x-1"><img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/></div>',l,J,V,Z,_e='<a href="https://huggingface.co/papers/2410.05355" rel="nofollow">FalconMamba</a> is a 7B large language model, available as pretrained and instruction-tuned variants, based on the <a href="./mamba">Mamba</a>. This model implements a pure Mamba design that focuses on computational efficiency while maintaining strong performance. FalconMamba is significantly faster at inference and requires substantially less memory for long sequence generation. The models are pretrained on a diverse 5.8T token dataset including <a href="https://huggingface.co/datasets/tiiuae/falcon-refinedweb" rel="nofollow">RefinedWeb</a>, technical content, code, and mathematical data.',Te,H,ot='You can find the official FalconMamba checkpoints in the <a href="https://huggingface.co/collections/tiiuae/falconmamba-7b-66b9a580324dd1598b0f6d4a" rel="nofollow">FalconMamba 7B</a> collection.',we,G,$e,q,st='The examples below demonstrate how to generate text with <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline">Pipeline</a>, <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoModel">AutoModel</a>, and from the command line.',Je,R,ve,Q,rt='Quantization reduces the memory burden of large models by representing the weights in a lower precision. Refer to the <a href="../quantization/overview">Quantization</a> overview for more available quantization backends.',Fe,A,lt='The example below uses <a href="../quantization/bitsandbytes">bitsandbytes</a> to quantize the weights to 4-bits.',Ce,S,je,P,ke,C,D,Re,ie,it=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/falcon_mamba#transformers.FalconMambaModel">FalconMambaModel</a>. It is used to instantiate a FALCON_MAMBA
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 FALCON_MAMBA
<a href="https://huggingface.co/tiiuae/falcon-mamba-7b" rel="nofollow">tiiuae/falcon-mamba-7b</a> architecture.`,Ne,ce,ct=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ee,N,Ue,O,xe,v,K,Xe,de,dt="The bare FALCONMAMBA Model transformer outputting raw hidden-states without any specific head on top.",Le,me,mt=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Ye,pe,pt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,Ve,U,ee,He,fe,ft='The <a href="/docs/transformers/main/en/model_doc/falcon_mamba#transformers.FalconMambaModel">FalconMambaModel</a> forward method, overrides the <code>__call__</code> special method.',qe,E,Qe,X,Ie,te,We,F,ae,Ae,ue,ut=`The FALCONMAMBA Model transformer with a language modeling head on top (linear layer with weights tied to the input
embeddings).`,Se,he,ht=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Pe,ge,gt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,De,x,ne,Oe,be,bt='The <a href="/docs/transformers/main/en/model_doc/falcon_mamba#transformers.FalconMambaForCausalLM">FalconMambaForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',Ke,L,et,Y,ze,oe,Ze,Me,Be;return J=new Ge({props:{title:"FalconMamba",local:"falconmamba",headingTag:"h1"}}),G=new tt({props:{warning:!1,$$slots:{default:[jt]},$$scope:{ctx:w}}}),R=new Ct({props:{id:"usage",options:["Pipeline","AutoModel","transformers-cli"],$$slots:{default:[It]},$$scope:{ctx:w}}}),S=new le({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEZhbGNvbk1hbWJhRm9yQ2F1c2FsTE0lMkMlMjBCaXRzQW5kQnl0ZXNDb25maWclMEElMEFxdWFudGl6YXRpb25fY29uZmlnJTIwJTNEJTIwQml0c0FuZEJ5dGVzQ29uZmlnKCUwQSUyMCUyMCUyMCUyMGxvYWRfaW5fNGJpdCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBibmJfNGJpdF9jb21wdXRlX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjBibmJfNGJpdF9xdWFudF90eXBlJTNEJTIybmY0JTIyJTJDJTBBJTIwJTIwJTIwJTIwYm5iXzRiaXRfdXNlX2RvdWJsZV9xdWFudCUzRFRydWUlMkMlMEEpJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIydGlpdWFlJTJGZmFsY29uLW1hbWJhLTdiJTIyKSUwQW1vZGVsJTIwJTNEJTIwRmFsY29uTWFtYmFGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIydGlpdWFlJTJGZmFsY29uLW1hbWJhLTdiJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJhdXRvJTIyJTJDJTBBJTIwJTIwJTIwJTIwcXVhbnRpemF0aW9uX2NvbmZpZyUzRHF1YW50aXphdGlvbl9jb25maWclMkMlMEEpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkV4cGxhaW4lMjB0aGUlMjBjb25jZXB0JTIwb2YlMjBzdGF0ZSUyMHNwYWNlJTIwbW9kZWxzJTIwaW4lMjBzaW1wbGUlMjB0ZXJtcyUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKCUyMmN1ZGElMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDApJTBBcHJpbnQodG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FalconMambaForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(
    load_in_4bit=<span class="hljs-literal">True</span>,
    bnb_4bit_compute_dtype=torch.bfloat16,
    bnb_4bit_quant_type=<span class="hljs-string">&quot;nf4&quot;</span>,
    bnb_4bit_use_double_quant=<span class="hljs-literal">True</span>,
)

tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;tiiuae/falcon-mamba-7b&quot;</span>)
model = FalconMambaForCausalLM.from_pretrained(
    <span class="hljs-string">&quot;tiiuae/falcon-mamba-7b&quot;</span>,
    torch_dtype=torch.bfloat16,
    device_map=<span class="hljs-string">&quot;auto&quot;</span>,
    quantization_config=quantization_config,
)

inputs = tokenizer(<span class="hljs-string">&quot;Explain the concept of state space models in simple terms&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
outputs = model.generate(**inputs, max_new_tokens=<span class="hljs-number">100</span>)
<span class="hljs-built_in">print</span>(tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>))`,wrap:!1}}),P=new Ge({props:{title:"FalconMambaConfig",local:"transformers.FalconMambaConfig",headingTag:"h2"}}),D=new ye({props:{name:"class transformers.FalconMambaConfig",anchor:"transformers.FalconMambaConfig",parameters:[{name:"vocab_size",val:" = 50280"},{name:"hidden_size",val:" = 768"},{name:"state_size",val:" = 16"},{name:"num_hidden_layers",val:" = 32"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 0"},{name:"expand",val:" = 2"},{name:"conv_kernel",val:" = 4"},{name:"use_bias",val:" = False"},{name:"use_conv_bias",val:" = True"},{name:"hidden_act",val:" = 'silu'"},{name:"initializer_range",val:" = 0.1"},{name:"residual_in_fp32",val:" = True"},{name:"time_step_rank",val:" = 'auto'"},{name:"time_step_scale",val:" = 1.0"},{name:"time_step_min",val:" = 0.001"},{name:"time_step_max",val:" = 0.1"},{name:"time_step_init_scheme",val:" = 'random'"},{name:"time_step_floor",val:" = 0.0001"},{name:"rescale_prenorm_residual",val:" = False"},{name:"use_cache",val:" = True"},{name:"use_mambapy",val:" = False"},{name:"mixer_rms_eps",val:" = 1e-06"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FalconMambaConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50280) &#x2014;
Vocabulary size of the FALCON_MAMBA model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/falcon_mamba#transformers.FalconMambaModel">FalconMambaModel</a>.`,name:"vocab_size"},{anchor:"transformers.FalconMambaConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"hidden_size"},{anchor:"transformers.FalconMambaConfig.state_size",description:"<strong>state_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014; shape of the state space latents.",name:"state_size"},{anchor:"transformers.FalconMambaConfig.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 model.`,name:"num_hidden_layers"},{anchor:"transformers.FalconMambaConfig.layer_norm_epsilon",description:`<strong>layer_norm_epsilon</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon to use in the layer normalization layers.`,name:"layer_norm_epsilon"},{anchor:"transformers.FalconMambaConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Padding token id.`,name:"pad_token_id"},{anchor:"transformers.FalconMambaConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the beginning of sentence token in the vocabulary.`,name:"bos_token_id"},{anchor:"transformers.FalconMambaConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the end of sentence token in the vocabulary.`,name:"eos_token_id"},{anchor:"transformers.FalconMambaConfig.expand",description:"<strong>expand</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014; Expanding factor used to determine the intermediate size.",name:"expand"},{anchor:"transformers.FalconMambaConfig.conv_kernel",description:"<strong>conv_kernel</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014; Size of the convolution kernel.",name:"conv_kernel"},{anchor:"transformers.FalconMambaConfig.use_bias",description:`<strong>use_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use bias in [&#x201C;in_proj&#x201D;, &#x201C;out_proj&#x201D;] of the mixer block`,name:"use_bias"},{anchor:"transformers.FalconMambaConfig.use_conv_bias",description:`<strong>use_conv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use bias in the convolution layer of the mixer block.`,name:"use_conv_bias"},{anchor:"transformers.FalconMambaConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder.`,name:"hidden_act"},{anchor:"transformers.FalconMambaConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.FalconMambaConfig.residual_in_fp32",description:`<strong>residual_in_fp32</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not residuals should be in <code>float32</code>. If set to <code>False</code> residuals will keep the same <code>dtype</code> as the rest of the model`,name:"residual_in_fp32"},{anchor:"transformers.FalconMambaConfig.time_step_rank",description:`<strong>time_step_rank</strong> (<code>Union[int,str]</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
Rank of the discretization projection matrix. <code>&quot;auto&quot;</code> means that it will default to <code>math.ceil(self.hidden_size / 16)</code>`,name:"time_step_rank"},{anchor:"transformers.FalconMambaConfig.time_step_scale",description:`<strong>time_step_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Scale used used to scale <code>dt_proj.bias</code>.`,name:"time_step_scale"},{anchor:"transformers.FalconMambaConfig.time_step_min",description:`<strong>time_step_min</strong> (<code>float</code>, <em>optional</em>, defaults to 0.001) &#x2014;
Minimum <code>time_step</code> used to bound <code>dt_proj.bias</code>.`,name:"time_step_min"},{anchor:"transformers.FalconMambaConfig.time_step_max",description:`<strong>time_step_max</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Maximum <code>time_step</code> used to bound <code>dt_proj.bias</code>.`,name:"time_step_max"},{anchor:"transformers.FalconMambaConfig.time_step_init_scheme",description:`<strong>time_step_init_scheme</strong> (<code>float</code>, <em>optional</em>, defaults to <code>&quot;random&quot;</code>) &#x2014;
Init scheme used for <code>dt_proj.weight</code>. Should be one of <code>[&quot;random&quot;,&quot;uniform&quot;]</code>`,name:"time_step_init_scheme"},{anchor:"transformers.FalconMambaConfig.time_step_floor",description:`<strong>time_step_floor</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0001) &#x2014;
Minimum clamping value of the <code>dt_proj.bias</code> layer initialization.`,name:"time_step_floor"},{anchor:"transformers.FalconMambaConfig.rescale_prenorm_residual",description:`<strong>rescale_prenorm_residual</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to rescale <code>out_proj</code> weights when initializing.`,name:"rescale_prenorm_residual"},{anchor:"transformers.FalconMambaConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the cache should be used.`,name:"use_cache"},{anchor:"transformers.FalconMambaConfig.use_mambapy",description:`<strong>use_mambapy</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Determines the fallback strategy during training if the CUDA-based official implementation of FalconMamba is not available. If <code>True</code>, the falcon_mamba.py implementation is used. If <code>False</code>, the naive and slower implementation is used. Consider switching to the naive version if memory is limited.`,name:"use_mambapy"},{anchor:"transformers.FalconMambaConfig.mixer_rms_eps",description:`<strong>mixer_rms_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The RMS norm epsilon value that is used in the Mixer RMS norm for B, C and dt states.`,name:"mixer_rms_eps"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/falcon_mamba/configuration_falcon_mamba.py#L26"}}),N=new at({props:{anchor:"transformers.FalconMambaConfig.example",$$slots:{default:[Wt]},$$scope:{ctx:w}}}),O=new Ge({props:{title:"FalconMambaModel",local:"transformers.FalconMambaModel",headingTag:"h2"}}),K=new ye({props:{name:"class transformers.FalconMambaModel",anchor:"transformers.FalconMambaModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FalconMambaModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/falcon_mamba#transformers.FalconMambaConfig">FalconMambaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py#L606"}}),ee=new ye({props:{name:"forward",anchor:"transformers.FalconMambaModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.LongTensor] = None"},{name:"cache_params",val:": typing.Optional[transformers.cache_utils.MambaCache] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.FalconMambaModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>cache_params.seqlen_offset&gt;0</code>, 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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.FalconMambaModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FalconMambaModel.forward.cache_params",description:`<strong>cache_params</strong> (<code>MambaCache</code>, <em>optional</em>) &#x2014;
If passed along, the model uses the previous state in all the blocks (which will give the output for the
<code>input_ids</code> provided as if the model add <code>state_input_ids + input_ids</code> as context).`,name:"cache_params"},{anchor:"transformers.FalconMambaModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the <code>cache_params</code> is returned and can be used to quickly generate the next logits.`,name:"use_cache"},{anchor:"transformers.FalconMambaModel.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.FalconMambaModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py#L630",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaOutput</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/main/en/model_doc/falcon_mamba#transformers.FalconMambaConfig"
>FalconMambaConfig</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>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>cache_params</strong> (<code>MambaCache</code>) — The state of the model at the last time step. Can be used in a forward method with the next <code>input_ids</code> to
avoid providing the old <code>input_ids</code>.</p>
<p>Includes both the State space model state matrices after the selective scan, and the Convolutional states</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),E=new tt({props:{$$slots:{default:[zt]},$$scope:{ctx:w}}}),X=new at({props:{anchor:"transformers.FalconMambaModel.forward.example",$$slots:{default:[Zt]},$$scope:{ctx:w}}}),te=new Ge({props:{title:"FalconMambaLMHeadModel",local:"transformers.FalconMambaForCausalLM",headingTag:"h2"}}),ae=new ye({props:{name:"class transformers.FalconMambaForCausalLM",anchor:"transformers.FalconMambaForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FalconMambaForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/falcon_mamba#transformers.FalconMambaConfig">FalconMambaConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py#L712"}}),ne=new ye({props:{name:"forward",anchor:"transformers.FalconMambaForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cache_params",val:": typing.Optional[transformers.cache_utils.MambaCache] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FalconMambaForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, input_ids_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>If <code>cache_params.seqlen_offset&gt;0</code>, 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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.FalconMambaForCausalLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FalconMambaForCausalLM.forward.cache_params",description:`<strong>cache_params</strong> (<code>MambaCache</code>, <em>optional</em>) &#x2014;
If passed along, the model uses the previous state in all the blocks (which will give the output for the
<code>input_ids</code> provided as if the model add <code>state_input_ids + input_ids</code> as context).`,name:"cache_params"},{anchor:"transformers.FalconMambaForCausalLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, the <code>cache_params</code> is returned and can be used to quickly generate the next logits.`,name:"use_cache"},{anchor:"transformers.FalconMambaForCausalLM.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.FalconMambaForCausalLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FalconMambaForCausalLM.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/main/src/transformers/models/falcon_mamba/modeling_falcon_mamba.py#L809",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaCausalLMOutput</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/main/en/model_doc/falcon_mamba#transformers.FalconMambaConfig"
>FalconMambaConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>cache_params</strong> (<code>MambaCache</code>) — The state of the model at the last time step. Can be used in a forward method with the next <code>input_ids</code> to
avoid providing the old <code>input_ids</code>.</p>
<p>Includes both the State space model state matrices after the selective scan, and the Convolutional states</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.falcon_mamba.modeling_falcon_mamba.FalconMambaCausalLMOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),L=new tt({props:{$$slots:{default:[Bt]},$$scope:{ctx:w}}}),Y=new at({props:{anchor:"transformers.FalconMambaForCausalLM.forward.example",$$slots:{default:[Gt]},$$scope:{ctx:w}}}),oe=new Ft({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/falcon_mamba.md"}}),{c(){t=u("meta"),i=c(),a=u("p"),r=c(),p=u("div"),p.innerHTML=o,l=c(),g(J.$$.fragment),V=c(),Z=u("p"),Z.innerHTML=_e,Te=c(),H=u("p"),H.innerHTML=ot,we=c(),g(G.$$.fragment),$e=c(),q=u("p"),q.innerHTML=st,Je=c(),g(R.$$.fragment),ve=c(),Q=u("p"),Q.innerHTML=rt,Fe=c(),A=u("p"),A.innerHTML=lt,Ce=c(),g(S.$$.fragment),je=c(),g(P.$$.fragment),ke=c(),C=u("div"),g(D.$$.fragment),Re=c(),ie=u("p"),ie.innerHTML=it,Ne=c(),ce=u("p"),ce.innerHTML=ct,Ee=c(),g(N.$$.fragment),Ue=c(),g(O.$$.fragment),xe=c(),v=u("div"),g(K.$$.fragment),Xe=c(),de=u("p"),de.textContent=dt,Le=c(),me=u("p"),me.innerHTML=mt,Ye=c(),pe=u("p"),pe.innerHTML=pt,Ve=c(),U=u("div"),g(ee.$$.fragment),He=c(),fe=u("p"),fe.innerHTML=ft,qe=c(),g(E.$$.fragment),Qe=c(),g(X.$$.fragment),Ie=c(),g(te.$$.fragment),We=c(),F=u("div"),g(ae.$$.fragment),Ae=c(),ue=u("p"),ue.textContent=ut,Se=c(),he=u("p"),he.innerHTML=ht,Pe=c(),ge=u("p"),ge.innerHTML=gt,De=c(),x=u("div"),g(ne.$$.fragment),Oe=c(),be=u("p"),be.innerHTML=bt,Ke=c(),g(L.$$.fragment),et=c(),g(Y.$$.fragment),ze=c(),g(oe.$$.fragment),Ze=c(),Me=u("p"),this.h()},l(e){const n=Jt("svelte-u9bgzb",document.head);t=h(n,"META",{name:!0,content:!0}),n.forEach(s),i=d(e),a=h(e,"P",{}),se(a).forEach(s),r=d(e),p=h(e,"DIV",{style:!0,"data-svelte-h":!0}),$(p)!=="svelte-wa5t4p"&&(p.innerHTML=o),l=d(e),b(J.$$.fragment,e),V=d(e),Z=h(e,"P",{"data-svelte-h":!0}),$(Z)!=="svelte-mfwozy"&&(Z.innerHTML=_e),Te=d(e),H=h(e,"P",{"data-svelte-h":!0}),$(H)!=="svelte-1bq960n"&&(H.innerHTML=ot),we=d(e),b(G.$$.fragment,e),$e=d(e),q=h(e,"P",{"data-svelte-h":!0}),$(q)!=="svelte-rdli43"&&(q.innerHTML=st),Je=d(e),b(R.$$.fragment,e),ve=d(e),Q=h(e,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-nf5ooi"&&(Q.innerHTML=rt),Fe=d(e),A=h(e,"P",{"data-svelte-h":!0}),$(A)!=="svelte-1ca5nhg"&&(A.innerHTML=lt),Ce=d(e),b(S.$$.fragment,e),je=d(e),b(P.$$.fragment,e),ke=d(e),C=h(e,"DIV",{class:!0});var I=se(C);b(D.$$.fragment,I),Re=d(I),ie=h(I,"P",{"data-svelte-h":!0}),$(ie)!=="svelte-i5sdtz"&&(ie.innerHTML=it),Ne=d(I),ce=h(I,"P",{"data-svelte-h":!0}),$(ce)!=="svelte-o55m63"&&(ce.innerHTML=ct),Ee=d(I),b(N.$$.fragment,I),I.forEach(s),Ue=d(e),b(O.$$.fragment,e),xe=d(e),v=h(e,"DIV",{class:!0});var j=se(v);b(K.$$.fragment,j),Xe=d(j),de=h(j,"P",{"data-svelte-h":!0}),$(de)!=="svelte-vegge"&&(de.textContent=dt),Le=d(j),me=h(j,"P",{"data-svelte-h":!0}),$(me)!=="svelte-6pahdo"&&(me.innerHTML=mt),Ye=d(j),pe=h(j,"P",{"data-svelte-h":!0}),$(pe)!=="svelte-hswkmf"&&(pe.innerHTML=pt),Ve=d(j),U=h(j,"DIV",{class:!0});var W=se(U);b(ee.$$.fragment,W),He=d(W),fe=h(W,"P",{"data-svelte-h":!0}),$(fe)!=="svelte-yet315"&&(fe.innerHTML=ft),qe=d(W),b(E.$$.fragment,W),Qe=d(W),b(X.$$.fragment,W),W.forEach(s),j.forEach(s),Ie=d(e),b(te.$$.fragment,e),We=d(e),F=h(e,"DIV",{class:!0});var k=se(F);b(ae.$$.fragment,k),Ae=d(k),ue=h(k,"P",{"data-svelte-h":!0}),$(ue)!=="svelte-g0dgxw"&&(ue.textContent=ut),Se=d(k),he=h(k,"P",{"data-svelte-h":!0}),$(he)!=="svelte-6pahdo"&&(he.innerHTML=ht),Pe=d(k),ge=h(k,"P",{"data-svelte-h":!0}),$(ge)!=="svelte-hswkmf"&&(ge.innerHTML=gt),De=d(k),x=h(k,"DIV",{class:!0});var z=se(x);b(ne.$$.fragment,z),Oe=d(z),be=h(z,"P",{"data-svelte-h":!0}),$(be)!=="svelte-pk1lht"&&(be.innerHTML=bt),Ke=d(z),b(L.$$.fragment,z),et=d(z),b(Y.$$.fragment,z),z.forEach(s),k.forEach(s),ze=d(e),b(oe.$$.fragment,e),Ze=d(e),Me=h(e,"P",{}),se(Me).forEach(s),this.h()},h(){re(t,"name","hf:doc:metadata"),re(t,"content",Nt),vt(p,"float","right"),re(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),re(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){f(document.head,t),m(e,i,n),m(e,a,n),m(e,r,n),m(e,p,n),m(e,l,n),_(J,e,n),m(e,V,n),m(e,Z,n),m(e,Te,n),m(e,H,n),m(e,we,n),_(G,e,n),m(e,$e,n),m(e,q,n),m(e,Je,n),_(R,e,n),m(e,ve,n),m(e,Q,n),m(e,Fe,n),m(e,A,n),m(e,Ce,n),_(S,e,n),m(e,je,n),_(P,e,n),m(e,ke,n),m(e,C,n),_(D,C,null),f(C,Re),f(C,ie),f(C,Ne),f(C,ce),f(C,Ee),_(N,C,null),m(e,Ue,n),_(O,e,n),m(e,xe,n),m(e,v,n),_(K,v,null),f(v,Xe),f(v,de),f(v,Le),f(v,me),f(v,Ye),f(v,pe),f(v,Ve),f(v,U),_(ee,U,null),f(U,He),f(U,fe),f(U,qe),_(E,U,null),f(U,Qe),_(X,U,null),m(e,Ie,n),_(te,e,n),m(e,We,n),m(e,F,n),_(ae,F,null),f(F,Ae),f(F,ue),f(F,Se),f(F,he),f(F,Pe),f(F,ge),f(F,De),f(F,x),_(ne,x,null),f(x,Oe),f(x,be),f(x,Ke),_(L,x,null),f(x,et),_(Y,x,null),m(e,ze,n),_(oe,e,n),m(e,Ze,n),m(e,Me,n),Be=!0},p(e,[n]){const I={};n&2&&(I.$$scope={dirty:n,ctx:e}),G.$set(I);const j={};n&2&&(j.$$scope={dirty:n,ctx:e}),R.$set(j);const W={};n&2&&(W.$$scope={dirty:n,ctx:e}),N.$set(W);const k={};n&2&&(k.$$scope={dirty:n,ctx:e}),E.$set(k);const z={};n&2&&(z.$$scope={dirty:n,ctx:e}),X.$set(z);const _t={};n&2&&(_t.$$scope={dirty:n,ctx:e}),L.$set(_t);const Mt={};n&2&&(Mt.$$scope={dirty:n,ctx:e}),Y.$set(Mt)},i(e){Be||(M(J.$$.fragment,e),M(G.$$.fragment,e),M(R.$$.fragment,e),M(S.$$.fragment,e),M(P.$$.fragment,e),M(D.$$.fragment,e),M(N.$$.fragment,e),M(O.$$.fragment,e),M(K.$$.fragment,e),M(ee.$$.fragment,e),M(E.$$.fragment,e),M(X.$$.fragment,e),M(te.$$.fragment,e),M(ae.$$.fragment,e),M(ne.$$.fragment,e),M(L.$$.fragment,e),M(Y.$$.fragment,e),M(oe.$$.fragment,e),Be=!0)},o(e){y(J.$$.fragment,e),y(G.$$.fragment,e),y(R.$$.fragment,e),y(S.$$.fragment,e),y(P.$$.fragment,e),y(D.$$.fragment,e),y(N.$$.fragment,e),y(O.$$.fragment,e),y(K.$$.fragment,e),y(ee.$$.fragment,e),y(E.$$.fragment,e),y(X.$$.fragment,e),y(te.$$.fragment,e),y(ae.$$.fragment,e),y(ne.$$.fragment,e),y(L.$$.fragment,e),y(Y.$$.fragment,e),y(oe.$$.fragment,e),Be=!1},d(e){e&&(s(i),s(a),s(r),s(p),s(l),s(V),s(Z),s(Te),s(H),s(we),s($e),s(q),s(Je),s(ve),s(Q),s(Fe),s(A),s(Ce),s(je),s(ke),s(C),s(Ue),s(xe),s(v),s(Ie),s(We),s(F),s(ze),s(Ze),s(Me)),s(t),T(J,e),T(G,e),T(R,e),T(S,e),T(P,e),T(D),T(N),T(O,e),T(K),T(ee),T(E),T(X),T(te,e),T(ae),T(ne),T(L),T(Y),T(oe,e)}}}const Nt='{"title":"FalconMamba","local":"falconmamba","sections":[{"title":"FalconMambaConfig","local":"transformers.FalconMambaConfig","sections":[],"depth":2},{"title":"FalconMambaModel","local":"transformers.FalconMambaModel","sections":[],"depth":2},{"title":"FalconMambaLMHeadModel","local":"transformers.FalconMambaForCausalLM","sections":[],"depth":2}],"depth":1}';function Et(w){return Tt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class St extends wt{constructor(t){super(),$t(this,t,Et,Rt,yt,{})}}export{St as component};
