import{s as wn,z as kn,o as Zn,n as Xe}from"../chunks/scheduler.18a86fab.js";import{S as $n,i as Cn,g as l,s as a,r as u,A as xn,h as d,f as n,c as s,j as H,u as h,x as y,k as j,y as c,a as o,v as f,d as g,t as _,w as b}from"../chunks/index.98837b22.js";import{T as Qt}from"../chunks/Tip.77304350.js";import{D as Ce}from"../chunks/Docstring.6758ea23.js";import{C as Se}from"../chunks/CodeBlock.8d0c2e8a.js";import{E as Pt}from"../chunks/ExampleCodeBlock.0c42463f.js";import{H as U}from"../chunks/Heading.7e7e0c5b.js";import{E as zn}from"../chunks/index.499f366c.js";function jn($){let r,M=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=l("p"),r.innerHTML=M},l(m){r=d(m,"P",{"data-svelte-h":!0}),y(r)!=="svelte-fincs2"&&(r.innerHTML=M)},m(m,p){o(m,r,p)},p:Xe,d(m){m&&n(r)}}}function Jn($){let r,M=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=l("p"),r.innerHTML=M},l(m){r=d(m,"P",{"data-svelte-h":!0}),y(r)!=="svelte-fincs2"&&(r.innerHTML=M)},m(m,p){o(m,r,p)},p:Xe,d(m){m&&n(r)}}}function Un($){let r,M="Example:",m,p,T;return p=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBaYW1iYUZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBaYW1iYUZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZCglMjJaeXBocmElMkZaYW1iYS03Qi12MSUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJaeXBocmElMkZaYW1iYS03Qi12MSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJIZXklMkMlMjBhcmUlMjB5b3UlMjBjb25zY2lvdXMlM0YlMjBDYW4lMjB5b3UlMjB0YWxrJTIwdG8lMjBtZSUzRiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQSUyMyUyMEdlbmVyYXRlJTBBZ2VuZXJhdGVfaWRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzLmlucHV0X2lkcyUyQyUyMG1heF9sZW5ndGglM0QzMCklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlX2lkcyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlJTJDJTIwY2xlYW5fdXBfdG9rZW5pemF0aW9uX3NwYWNlcyUzREZhbHNlKSU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ZambaForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = ZambaForCausalLM.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Hey, are you conscious? Can you talk to me?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Generate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generate_ids = model.generate(inputs.input_ids, max_length=<span class="hljs-number">30</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generate_ids, skip_special_tokens=<span class="hljs-literal">True</span>, clean_up_tokenization_spaces=<span class="hljs-literal">False</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;Hey, are you conscious? Can you talk to me?\\nI&#x27;m not conscious, but I can talk to you.&quot;</span>`,wrap:!1}}),{c(){r=l("p"),r.textContent=M,m=a(),u(p.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),y(r)!=="svelte-11lpom8"&&(r.textContent=M),m=s(i),h(p.$$.fragment,i)},m(i,v){o(i,r,v),o(i,m,v),f(p,i,v),T=!0},p:Xe,i(i){T||(g(p.$$.fragment,i),T=!0)},o(i){_(p.$$.fragment,i),T=!1},d(i){i&&(n(r),n(m)),b(p,i)}}}function Wn($){let r,M=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=l("p"),r.innerHTML=M},l(m){r=d(m,"P",{"data-svelte-h":!0}),y(r)!=="svelte-fincs2"&&(r.innerHTML=M)},m(m,p){o(m,r,p)},p:Xe,d(m){m&&n(r)}}}function Fn($){let r,M="Example of single-label classification:",m,p,T;return p=new Se({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFphbWJhRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMlp5cGhyYSUyRlphbWJhLTdCLXYxJTIyKSUwQW1vZGVsJTIwJTNEJTIwWmFtYmFGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJaeXBocmElMkZaYW1iYS03Qi12MSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWQlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KCkuaXRlbSgpJTBBbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2NsYXNzX2lkJTVEJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwWmFtYmFGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJaeXBocmElMkZaYW1iYS03Qi12MSUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",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, ZambaForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ZambaForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&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>model.config.id2label[predicted_class_id]
...

<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 = ZambaForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&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
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
...`,wrap:!1}}),{c(){r=l("p"),r.textContent=M,m=a(),u(p.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),y(r)!=="svelte-ykxpe4"&&(r.textContent=M),m=s(i),h(p.$$.fragment,i)},m(i,v){o(i,r,v),o(i,m,v),f(p,i,v),T=!0},p:Xe,i(i){T||(g(p.$$.fragment,i),T=!0)},o(i){_(p.$$.fragment,i),T=!1},d(i){i&&(n(r),n(m)),b(p,i)}}}function qn($){let r,M="Example of multi-label classification:",m,p,T;return p=new Se({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFphbWJhRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMlp5cGhyYSUyRlphbWJhLTdCLXYxJTIyKSUwQW1vZGVsJTIwJTNEJTIwWmFtYmFGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJaeXBocmElMkZaYW1iYS03Qi12MSUyMiUyQyUyMHByb2JsZW1fdHlwZSUzRCUyMm11bHRpX2xhYmVsX2NsYXNzaWZpY2F0aW9uJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZHMlMjAlM0QlMjB0b3JjaC5hcmFuZ2UoMCUyQyUyMGxvZ2l0cy5zaGFwZSU1Qi0xJTVEKSU1QnRvcmNoLnNpZ21vaWQobG9naXRzKS5zcXVlZXplKGRpbSUzRDApJTIwJTNFJTIwMC41JTVEJTBBJTBBJTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwWmFtYmFGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJaeXBocmElMkZaYW1iYS03Qi12MSUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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, ZambaForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ZambaForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&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 = ZambaForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&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`,wrap:!1}}),{c(){r=l("p"),r.textContent=M,m=a(),u(p.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),y(r)!=="svelte-1l8e32d"&&(r.textContent=M),m=s(i),h(p.$$.fragment,i)},m(i,v){o(i,r,v),o(i,m,v),f(p,i,v),T=!0},p:Xe,i(i){T||(g(p.$$.fragment,i),T=!0)},o(i){_(p.$$.fragment,i),T=!1},d(i){i&&(n(r),n(m)),b(p,i)}}}function In($){let r,M,m,p,T,i,v,Et='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Ge,Q,At='Zamba is a large language model (LLM) trained by Zyphra, and made available under an Apache 2.0 license. Please see the <a href="https://huggingface.co/collections/zyphra/" rel="nofollow">Zyphra Hugging Face</a> repository for model weights.',Re,P,Dt='This model was contributed by <a href="https://huggingface.co/pglo" rel="nofollow">pglo</a>.',Qe,E,Pe,A,Ot='Zamba-7B-v1 is a hybrid between state-space models (Specifically <a href="https://github.com/state-spaces/mamba" rel="nofollow">Mamba</a>) and transformer, and was trained using next-token prediction. Zamba uses a shared transformer layer after every 6 mamba blocks. It uses the <a href="https://huggingface.co/mistralai/Mistral-7B-v0.1" rel="nofollow">Mistral v0.1 tokenizer</a>. We came to this architecture after a series of ablations at small scales. Zamba-7B-v1 was pre-trained on 1T tokens of text and code data.',Ee,N,Kt,Ae,D,De,O,Oe,K,en="Zamba requires you use <code>transformers</code> version 4.46.0 or higher:",Ke,ee,et,te,tn="In order to run optimized Mamba implementations, you first need to install <code>mamba-ssm</code> and <code>causal-conv1d</code>:",tt,ne,nt,oe,nn="You also have to have the model on a CUDA device.",ot,ae,on="You can run the model not using the optimized Mamba kernels, but it is <strong>not</strong> recommended as it will result in significantly lower latencies. In order to do that, you’ll need to specify <code>use_mamba_kernels=False</code> when loading the model.",at,se,st,re,rt,ie,it,le,an="The model cards can be found at:",lt,de,sn='<li><a href="MODEL_CARD_ZAMBA-7B-v1.md">Zamba-7B</a></li>',dt,ce,ct,me,rn='For issues with model output, or community discussion, please use the Hugging Face community <a href="https://huggingface.co/zyphra/zamba-7b" rel="nofollow">forum</a>',mt,pe,pt,ue,ln="The model weights are open-sourced via an Apache 2.0 license.",ut,he,ht,x,fe,kt,xe,dn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaModel">ZambaModel</a>. It is used to instantiate a
Zamba 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 Zamba-v0.1 model.`,Zt,ze,cn='<a href="https://huggingface.co/Zyphra/Zamba-7B-v1" rel="nofollow">Zyphra/Zamba-7B-v1</a>',$t,je,mn=`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.`,ft,ge,gt,Z,_e,Ct,Je,pn="The bare Zamba Model outputting raw hidden-states without any specific head on top.",xt,Ue,un=`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.)`,zt,We,hn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,jt,q,be,Jt,Fe,fn='The <a href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaModel">ZambaModel</a> forward method, overrides the <code>__call__</code> special method.',Ut,Y,_t,ye,bt,L,Me,Wt,J,Te,Ft,qe,gn='The <a href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaForCausalLM">ZambaForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',qt,S,It,X,yt,ve,Mt,w,we,Lt,Ie,_n="The Zamba Model with a sequence classification head on top (linear layer).",Bt,Le,bn=`<a href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaForSequenceClassification">ZambaForSequenceClassification</a> uses the last token in order to do the classification, as other causal models
(e.g. GPT-2) do.`,Ht,Be,yn=`Since it does classification on the last token, it requires to know the position of the last token. If a
<code>pad_token_id</code> is defined in the configuration, it finds the last token that is not a padding token in each row. If
no <code>pad_token_id</code> is defined, it simply takes the last value in each row of the batch. Since it cannot guess the
padding tokens when <code>inputs_embeds</code> are passed instead of <code>input_ids</code>, it does the same (take the last value in
each row of the batch).`,Nt,He,Mn=`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.)`,Yt,Ne,Tn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,St,C,ke,Xt,Ye,vn='The <a href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaForSequenceClassification">ZambaForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Vt,V,Gt,G,Rt,R,Tt,Ze,vt,Ve,wt;return T=new U({props:{title:"Zamba",local:"zamba",headingTag:"h1"}}),E=new U({props:{title:"Model details",local:"model-details",headingTag:"h2"}}),D=new U({props:{title:"Quick start",local:"quick-start",headingTag:"h2"}}),O=new U({props:{title:"Presequities",local:"presequities",headingTag:"h3"}}),ee=new Se({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUzRSUzRDQuNDUuMA==",highlighted:"pip install transformers&gt;=4.45.0",wrap:!1}}),ne=new Se({props:{code:"cGlwJTIwaW5zdGFsbCUyMG1hbWJhLXNzbSUyMGNhdXNhbC1jb252MWQlM0UlM0QxLjIuMA==",highlighted:"pip install mamba-ssm causal-conv1d&gt;=1.2.0",wrap:!1}}),se=new U({props:{title:"Inference",local:"inference",headingTag:"h2"}}),re=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyWnlwaHJhJTJGWmFtYmEtN0ItdjElMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyWnlwaHJhJTJGWmFtYmEtN0ItdjElMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYpJTBBJTBBaW5wdXRfdGV4dCUyMCUzRCUyMCUyMkElMjBmdW5ueSUyMHByb21wdCUyMHdvdWxkJTIwYmUlMjAlMjIlMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIoaW5wdXRfdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKCUyMmN1ZGElMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqaW5wdXRfaWRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDApJTBBcHJpbnQodG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCkp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForCausalLM
<span class="hljs-keyword">import</span> torch

tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&quot;</span>)
model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;Zyphra/Zamba-7B-v1&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, torch_dtype=torch.bfloat16)

input_text = <span class="hljs-string">&quot;A funny prompt would be &quot;</span>
input_ids = tokenizer(input_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)

outputs = model.generate(**input_ids, 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>]))`,wrap:!1}}),ie=new U({props:{title:"Model card",local:"model-card",headingTag:"h2"}}),ce=new U({props:{title:"Issues",local:"issues",headingTag:"h2"}}),pe=new U({props:{title:"License",local:"license",headingTag:"h2"}}),he=new U({props:{title:"ZambaConfig",local:"transformers.ZambaConfig",headingTag:"h2"}}),fe=new Ce({props:{name:"class transformers.ZambaConfig",anchor:"transformers.ZambaConfig",parameters:[{name:"vocab_size",val:" = 32000"},{name:"tie_word_embeddings",val:" = True"},{name:"hidden_size",val:" = 3712"},{name:"attention_hidden_size",val:" = None"},{name:"intermediate_size",val:" = 14848"},{name:"num_hidden_layers",val:" = 76"},{name:"num_attention_heads",val:" = 16"},{name:"attention_head_dim",val:" = None"},{name:"num_key_value_heads",val:" = 16"},{name:"n_mamba_heads",val:" = 2"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_mamba_act",val:" = 'silu'"},{name:"initializer_range",val:" = 0.02"},{name:"rms_norm_eps",val:" = 1e-05"},{name:"use_cache",val:" = True"},{name:"num_logits_to_keep",val:" = 1"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 1"},{name:"eos_token_id",val:" = 2"},{name:"max_position_embeddings",val:" = 4096"},{name:"attention_dropout",val:" = 0.0"},{name:"attn_layer_period",val:" = 6"},{name:"attn_layer_offset",val:" = 4"},{name:"use_mamba_kernels",val:" = True"},{name:"mamba_d_state",val:" = 16"},{name:"mamba_d_conv",val:" = 4"},{name:"mamba_expand",val:" = 2"},{name:"mamba_dt_rank",val:" = 'auto'"},{name:"time_step_min",val:" = 0.001"},{name:"time_step_max",val:" = 0.1"},{name:"time_step_floor",val:" = 0.0001"},{name:"mamba_conv_bias",val:" = True"},{name:"mamba_proj_bias",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ZambaConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32000) &#x2014;
Vocabulary size of the Zamba 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/zamba#transformers.ZambaModel">ZambaModel</a>`,name:"vocab_size"},{anchor:"transformers.ZambaConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the model&#x2019;s input and output word embeddings should be tied. Note that this is only relevant if the
model has a output word embedding layer.`,name:"tie_word_embeddings"},{anchor:"transformers.ZambaConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3712) &#x2014;
Dimension of the hidden representations.`,name:"hidden_size"},{anchor:"transformers.ZambaConfig.attention_hidden_size",description:`<strong>attention_hidden_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Dimension of the hidden representations of the inputs to the Attention layer.`,name:"attention_hidden_size"},{anchor:"transformers.ZambaConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 14848) &#x2014;
Dimension of the MLP representations.`,name:"intermediate_size"},{anchor:"transformers.ZambaConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 76) &#x2014;
Number of hidden layers in the model.`,name:"num_hidden_layers"},{anchor:"transformers.ZambaConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"num_attention_heads"},{anchor:"transformers.ZambaConfig.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Dimension of the attention head in the Transformer decoder.`,name:"attention_head_dim"},{anchor:"transformers.ZambaConfig.num_key_value_heads",description:`<strong>num_key_value_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
<code>num_key_value_heads=None</code>, the model will use Multi Head Attention (MHA), if
\`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
by meanpooling all the original heads within that group. For more details checkout <a href="https://arxiv.org/pdf/2305.13245.pdf" rel="nofollow">this
paper</a>.`,name:"num_key_value_heads"},{anchor:"transformers.ZambaConfig.n_mamba_heads",description:`<strong>n_mamba_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Number of mamba heads for each mamba layer.`,name:"n_mamba_heads"},{anchor:"transformers.ZambaConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the decoder.`,name:"hidden_act"},{anchor:"transformers.ZambaConfig.hidden_mamba_act",description:`<strong>hidden_mamba_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;silu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the mamba layer.`,name:"hidden_mamba_act"},{anchor:"transformers.ZambaConfig.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.ZambaConfig.rms_norm_eps",description:`<strong>rms_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the rms normalization layers.`,name:"rms_norm_eps"},{anchor:"transformers.ZambaConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"},{anchor:"transformers.ZambaConfig.num_logits_to_keep",description:`<strong>num_logits_to_keep</strong> (<code>int</code> or <code>None</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of prompt logits to calculate during generation. If <code>None</code>, all logits will be calculated. If an
integer value, only last <code>num_logits_to_keep</code> logits will be calculated. Default is 1 because only the
logits of the last prompt token are needed for generation. For long sequences, the logits for the entire
sequence may use a lot of memory so, setting <code>num_logits_to_keep=1</code> will reduce memory footprint
significantly.`,name:"num_logits_to_keep"},{anchor:"transformers.ZambaConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The id of the padding token.`,name:"pad_token_id"},{anchor:"transformers.ZambaConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The id of the &#x201C;beginning-of-sequence&#x201D; token.`,name:"bos_token_id"},{anchor:"transformers.ZambaConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The id of the &#x201C;end-of-sequence&#x201D; token.`,name:"eos_token_id"},{anchor:"transformers.ZambaConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
This value doesn&#x2019;t have any real effect. The maximum sequence length that this model is intended to be
used with. It can be used with longer sequences, but performance may degrade.`,name:"max_position_embeddings"},{anchor:"transformers.ZambaConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.ZambaConfig.attn_layer_period",description:`<strong>attn_layer_period</strong> (<code>int</code>, <em>optional</em>, defaults to 6) &#x2014;
Once in this many layers, we will have a shared attention layer`,name:"attn_layer_period"},{anchor:"transformers.ZambaConfig.attn_layer_offset",description:`<strong>attn_layer_offset</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Offset of the shared attention layer`,name:"attn_layer_offset"},{anchor:"transformers.ZambaConfig.use_mamba_kernels",description:`<strong>use_mamba_kernels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Flag indicating whether or not to use the fast mamba kernels. These are available only if <code>mamba-ssm</code> and
<code>causal-conv1d</code> are installed, and the mamba modules are running on a CUDA device. Raises ValueError if
<code>True</code> and kernels are not available`,name:"use_mamba_kernels"},{anchor:"transformers.ZambaConfig.mamba_d_state",description:`<strong>mamba_d_state</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The dimension the mamba state space latents`,name:"mamba_d_state"},{anchor:"transformers.ZambaConfig.mamba_d_conv",description:`<strong>mamba_d_conv</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The size of the mamba convolution kernel`,name:"mamba_d_conv"},{anchor:"transformers.ZambaConfig.mamba_expand",description:`<strong>mamba_expand</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
Expanding factor (relative to hidden_size) used to determine the mamba intermediate size`,name:"mamba_expand"},{anchor:"transformers.ZambaConfig.mamba_dt_rank",description:`<strong>mamba_dt_rank</strong> (<code>Union[int,str]</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
Rank of the mamba discretization projection matrix. <code>&quot;auto&quot;</code> means that it will default to <code>math.ceil(self.hidden_size / 16)</code>`,name:"mamba_dt_rank"},{anchor:"transformers.ZambaConfig.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.ZambaConfig.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.ZambaConfig.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.ZambaConfig.mamba_conv_bias",description:`<strong>mamba_conv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Flag indicating whether or not to use bias in the convolution layer of the mamba mixer block.`,name:"mamba_conv_bias"},{anchor:"transformers.ZambaConfig.mamba_proj_bias",description:`<strong>mamba_proj_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Flag indicating whether or not to use bias in the input and output projections ([&#x201C;in_proj&#x201D;, &#x201C;out_proj&#x201D;]) of the mamba mixer block`,name:"mamba_proj_bias"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/zamba/configuration_zamba.py#L26"}}),ge=new U({props:{title:"ZambaModel",local:"transformers.ZambaModel",headingTag:"h2"}}),_e=new Ce({props:{name:"class transformers.ZambaModel",anchor:"transformers.ZambaModel",parameters:[{name:"config",val:": ZambaConfig"}],parametersDescription:[{anchor:"transformers.ZambaModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaConfig">ZambaConfig</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/zamba/modeling_zamba.py#L863"}}),be=new Ce({props:{name:"forward",anchor:"transformers.ZambaModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[transformers.models.zamba.modeling_zamba.ZambaHybridDynamicCache] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.ZambaModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</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.ZambaModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ZambaModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ZambaModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~models.zamba.modeling_zamba.ZambaHybridDynamicCache</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.ZambaModel.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.ZambaModel.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.ZambaModel.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.ZambaModel.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.ZambaModel.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.ZambaModel.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/zamba/modeling_zamba.py#L925",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaConfig"
>ZambaConfig</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>
<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>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a
  href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache"
>Cache</a> instance. For more details, see our <a
  href="https://huggingface.co/docs/transformers/en/kv_cache"
  rel="nofollow"
>kv cache guide</a>.</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>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPast"
>transformers.modeling_outputs.BaseModelOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Y=new Qt({props:{$$slots:{default:[jn]},$$scope:{ctx:$}}}),ye=new U({props:{title:"ZambaForCausalLM",local:"transformers.ZambaForCausalLM",headingTag:"h2"}}),Me=new Ce({props:{name:"class transformers.ZambaForCausalLM",anchor:"transformers.ZambaForCausalLM",parameters:[{name:"config",val:": ZambaConfig"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/zamba/modeling_zamba.py#L1073"}}),Te=new Ce({props:{name:"forward",anchor:"transformers.ZambaForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[transformers.models.zamba.modeling_zamba.ZambaHybridDynamicCache] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"cache_position",val:": typing.Optional[torch.LongTensor] = None"},{name:"logits_to_keep",val:": typing.Union[int, torch.Tensor] = 0"},{name:"**loss_kwargs",val:""}],parametersDescription:[{anchor:"transformers.ZambaForCausalLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</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.ZambaForCausalLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ZambaForCausalLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ZambaForCausalLM.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>~models.zamba.modeling_zamba.ZambaHybridDynamicCache</code>, <em>optional</em>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.ZambaForCausalLM.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.ZambaForCausalLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.ZambaForCausalLM.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.ZambaForCausalLM.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.ZambaForCausalLM.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.ZambaForCausalLM.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.ZambaForCausalLM.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(sequence_length)</code>, <em>optional</em>) &#x2014;
Indices depicting the position of the input sequence tokens in the sequence. Contrarily to <code>position_ids</code>,
this tensor is not affected by padding. It is used to update the cache in the correct position and to infer
the complete sequence length.`,name:"cache_position"},{anchor:"transformers.ZambaForCausalLM.forward.logits_to_keep",description:`<strong>logits_to_keep</strong> (<code>Union[int, torch.Tensor]</code>, defaults to <code>0</code>) &#x2014;
If an <code>int</code>, compute logits for the last <code>logits_to_keep</code> tokens. If <code>0</code>, calculate logits for all
<code>input_ids</code> (special case). Only last token logits are needed for generation, and calculating them only for that
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
If a <code>torch.Tensor</code>, must be 1D corresponding to the indices to keep in the sequence length dimension.
This is useful when using packed tensor format (single dimension for batch and sequence length).`,name:"logits_to_keep"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/zamba/modeling_zamba.py#L1102",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithPast"
>transformers.modeling_outputs.CausalLMOutputWithPast</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),S=new Qt({props:{$$slots:{default:[Jn]},$$scope:{ctx:$}}}),X=new Pt({props:{anchor:"transformers.ZambaForCausalLM.forward.example",$$slots:{default:[Un]},$$scope:{ctx:$}}}),ve=new U({props:{title:"ZambaForSequenceClassification",local:"transformers.ZambaForSequenceClassification",headingTag:"h2"}}),we=new Ce({props:{name:"class transformers.ZambaForSequenceClassification",anchor:"transformers.ZambaForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ZambaForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/zamba#transformers.ZambaForSequenceClassification">ZambaForSequenceClassification</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/zamba/modeling_zamba.py#L1244"}}),ke=new Ce({props:{name:"forward",anchor:"transformers.ZambaForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Union[transformers.cache_utils.Cache, typing.List[torch.FloatTensor], NoneType] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ZambaForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default.</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.ZambaForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ZambaForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.n_positions - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ZambaForSequenceClassification.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Union[~cache_utils.Cache, List[torch.FloatTensor], NoneType]</code>) &#x2014;
Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used to speed up sequential decoding. This typically consists in the <code>past_key_values</code>
returned by the model at a previous stage of decoding, when <code>use_cache=True</code> or <code>config.use_cache=True</code>.</p>
<p>Two formats are allowed:</p>
<ul>
<li>a <a href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache">Cache</a> instance, see our <a href="https://huggingface.co/docs/transformers/en/kv_cache" rel="nofollow">kv cache guide</a>;</li>
<li>Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of
shape <code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>). This is also known as the legacy
cache format.</li>
</ul>
<p>The model will output the same cache format that is fed as input. If no <code>past_key_values</code> are passed, the
legacy cache format will be returned.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>input_ids</code> (those that don&#x2019;t
have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all <code>input_ids</code>
of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.ZambaForSequenceClassification.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.ZambaForSequenceClassification.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"},{anchor:"transformers.ZambaForSequenceClassification.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.ZambaForSequenceClassification.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.ZambaForSequenceClassification.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.ZambaForSequenceClassification.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/zamba/modeling_zamba.py#L1275",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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/main/en/model_doc/zamba#transformers.ZambaConfig"
>ZambaConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (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>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>Cache</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) — It is a <a
  href="/docs/transformers/main/en/internal/generation_utils#transformers.Cache"
>Cache</a> instance. For more details, see our <a
  href="https://huggingface.co/docs/transformers/en/kv_cache"
  rel="nofollow"
>kv cache guide</a>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.modeling_outputs.SequenceClassifierOutputWithPast</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),V=new Qt({props:{$$slots:{default:[Wn]},$$scope:{ctx:$}}}),G=new Pt({props:{anchor:"transformers.ZambaForSequenceClassification.forward.example",$$slots:{default:[Fn]},$$scope:{ctx:$}}}),R=new Pt({props:{anchor:"transformers.ZambaForSequenceClassification.forward.example-2",$$slots:{default:[qn]},$$scope:{ctx:$}}}),Ze=new zn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/zamba.md"}}),{c(){r=l("meta"),M=a(),m=l("p"),p=a(),u(T.$$.fragment),i=a(),v=l("div"),v.innerHTML=Et,Ge=a(),Q=l("p"),Q.innerHTML=At,Re=a(),P=l("p"),P.innerHTML=Dt,Qe=a(),u(E.$$.fragment),Pe=a(),A=l("p"),A.innerHTML=Ot,Ee=a(),N=l("img"),Ae=a(),u(D.$$.fragment),De=a(),u(O.$$.fragment),Oe=a(),K=l("p"),K.innerHTML=en,Ke=a(),u(ee.$$.fragment),et=a(),te=l("p"),te.innerHTML=tn,tt=a(),u(ne.$$.fragment),nt=a(),oe=l("p"),oe.textContent=nn,ot=a(),ae=l("p"),ae.innerHTML=on,at=a(),u(se.$$.fragment),st=a(),u(re.$$.fragment),rt=a(),u(ie.$$.fragment),it=a(),le=l("p"),le.textContent=an,lt=a(),de=l("ul"),de.innerHTML=sn,dt=a(),u(ce.$$.fragment),ct=a(),me=l("p"),me.innerHTML=rn,mt=a(),u(pe.$$.fragment),pt=a(),ue=l("p"),ue.textContent=ln,ut=a(),u(he.$$.fragment),ht=a(),x=l("div"),u(fe.$$.fragment),kt=a(),xe=l("p"),xe.innerHTML=dn,Zt=a(),ze=l("p"),ze.innerHTML=cn,$t=a(),je=l("p"),je.innerHTML=mn,ft=a(),u(ge.$$.fragment),gt=a(),Z=l("div"),u(_e.$$.fragment),Ct=a(),Je=l("p"),Je.textContent=pn,xt=a(),Ue=l("p"),Ue.innerHTML=un,zt=a(),We=l("p"),We.innerHTML=hn,jt=a(),q=l("div"),u(be.$$.fragment),Jt=a(),Fe=l("p"),Fe.innerHTML=fn,Ut=a(),u(Y.$$.fragment),_t=a(),u(ye.$$.fragment),bt=a(),L=l("div"),u(Me.$$.fragment),Wt=a(),J=l("div"),u(Te.$$.fragment),Ft=a(),qe=l("p"),qe.innerHTML=gn,qt=a(),u(S.$$.fragment),It=a(),u(X.$$.fragment),yt=a(),u(ve.$$.fragment),Mt=a(),w=l("div"),u(we.$$.fragment),Lt=a(),Ie=l("p"),Ie.textContent=_n,Bt=a(),Le=l("p"),Le.innerHTML=bn,Ht=a(),Be=l("p"),Be.innerHTML=yn,Nt=a(),He=l("p"),He.innerHTML=Mn,Yt=a(),Ne=l("p"),Ne.innerHTML=Tn,St=a(),C=l("div"),u(ke.$$.fragment),Xt=a(),Ye=l("p"),Ye.innerHTML=vn,Vt=a(),u(V.$$.fragment),Gt=a(),u(G.$$.fragment),Rt=a(),u(R.$$.fragment),Tt=a(),u(Ze.$$.fragment),vt=a(),Ve=l("p"),this.h()},l(e){const t=xn("svelte-u9bgzb",document.head);r=d(t,"META",{name:!0,content:!0}),t.forEach(n),M=s(e),m=d(e,"P",{}),H(m).forEach(n),p=s(e),h(T.$$.fragment,e),i=s(e),v=d(e,"DIV",{class:!0,"data-svelte-h":!0}),y(v)!=="svelte-13t8s2t"&&(v.innerHTML=Et),Ge=s(e),Q=d(e,"P",{"data-svelte-h":!0}),y(Q)!=="svelte-1t92yrc"&&(Q.innerHTML=At),Re=s(e),P=d(e,"P",{"data-svelte-h":!0}),y(P)!=="svelte-1hxftw9"&&(P.innerHTML=Dt),Qe=s(e),h(E.$$.fragment,e),Pe=s(e),A=d(e,"P",{"data-svelte-h":!0}),y(A)!=="svelte-1xvlxd9"&&(A.innerHTML=Ot),Ee=s(e),N=d(e,"IMG",{src:!0,width:!0,height:!0}),Ae=s(e),h(D.$$.fragment,e),De=s(e),h(O.$$.fragment,e),Oe=s(e),K=d(e,"P",{"data-svelte-h":!0}),y(K)!=="svelte-xntbge"&&(K.innerHTML=en),Ke=s(e),h(ee.$$.fragment,e),et=s(e),te=d(e,"P",{"data-svelte-h":!0}),y(te)!=="svelte-1ruzjzk"&&(te.innerHTML=tn),tt=s(e),h(ne.$$.fragment,e),nt=s(e),oe=d(e,"P",{"data-svelte-h":!0}),y(oe)!=="svelte-1kmjqje"&&(oe.textContent=nn),ot=s(e),ae=d(e,"P",{"data-svelte-h":!0}),y(ae)!=="svelte-syhw7e"&&(ae.innerHTML=on),at=s(e),h(se.$$.fragment,e),st=s(e),h(re.$$.fragment,e),rt=s(e),h(ie.$$.fragment,e),it=s(e),le=d(e,"P",{"data-svelte-h":!0}),y(le)!=="svelte-ktiv3r"&&(le.textContent=an),lt=s(e),de=d(e,"UL",{"data-svelte-h":!0}),y(de)!=="svelte-mvai5e"&&(de.innerHTML=sn),dt=s(e),h(ce.$$.fragment,e),ct=s(e),me=d(e,"P",{"data-svelte-h":!0}),y(me)!=="svelte-ry96i"&&(me.innerHTML=rn),mt=s(e),h(pe.$$.fragment,e),pt=s(e),ue=d(e,"P",{"data-svelte-h":!0}),y(ue)!=="svelte-9pg9vx"&&(ue.textContent=ln),ut=s(e),h(he.$$.fragment,e),ht=s(e),x=d(e,"DIV",{class:!0});var W=H(x);h(fe.$$.fragment,W),kt=s(W),xe=d(W,"P",{"data-svelte-h":!0}),y(xe)!=="svelte-acog25"&&(xe.innerHTML=dn),Zt=s(W),ze=d(W,"P",{"data-svelte-h":!0}),y(ze)!=="svelte-bbuukh"&&(ze.innerHTML=cn),$t=s(W),je=d(W,"P",{"data-svelte-h":!0}),y(je)!=="svelte-o55m63"&&(je.innerHTML=mn),W.forEach(n),ft=s(e),h(ge.$$.fragment,e),gt=s(e),Z=d(e,"DIV",{class:!0});var z=H(Z);h(_e.$$.fragment,z),Ct=s(z),Je=d(z,"P",{"data-svelte-h":!0}),y(Je)!=="svelte-1xhk8q1"&&(Je.textContent=pn),xt=s(z),Ue=d(z,"P",{"data-svelte-h":!0}),y(Ue)!=="svelte-6pahdo"&&(Ue.innerHTML=un),zt=s(z),We=d(z,"P",{"data-svelte-h":!0}),y(We)!=="svelte-hswkmf"&&(We.innerHTML=hn),jt=s(z),q=d(z,"DIV",{class:!0});var B=H(q);h(be.$$.fragment,B),Jt=s(B),Fe=d(B,"P",{"data-svelte-h":!0}),y(Fe)!=="svelte-d6y5u6"&&(Fe.innerHTML=fn),Ut=s(B),h(Y.$$.fragment,B),B.forEach(n),z.forEach(n),_t=s(e),h(ye.$$.fragment,e),bt=s(e),L=d(e,"DIV",{class:!0});var $e=H(L);h(Me.$$.fragment,$e),Wt=s($e),J=d($e,"DIV",{class:!0});var F=H(J);h(Te.$$.fragment,F),Ft=s(F),qe=d(F,"P",{"data-svelte-h":!0}),y(qe)!=="svelte-qvmjhq"&&(qe.innerHTML=gn),qt=s(F),h(S.$$.fragment,F),It=s(F),h(X.$$.fragment,F),F.forEach(n),$e.forEach(n),yt=s(e),h(ve.$$.fragment,e),Mt=s(e),w=d(e,"DIV",{class:!0});var k=H(w);h(we.$$.fragment,k),Lt=s(k),Ie=d(k,"P",{"data-svelte-h":!0}),y(Ie)!=="svelte-qc231a"&&(Ie.textContent=_n),Bt=s(k),Le=d(k,"P",{"data-svelte-h":!0}),y(Le)!=="svelte-1lnezad"&&(Le.innerHTML=bn),Ht=s(k),Be=d(k,"P",{"data-svelte-h":!0}),y(Be)!=="svelte-10ugs3m"&&(Be.innerHTML=yn),Nt=s(k),He=d(k,"P",{"data-svelte-h":!0}),y(He)!=="svelte-6pahdo"&&(He.innerHTML=Mn),Yt=s(k),Ne=d(k,"P",{"data-svelte-h":!0}),y(Ne)!=="svelte-hswkmf"&&(Ne.innerHTML=Tn),St=s(k),C=d(k,"DIV",{class:!0});var I=H(C);h(ke.$$.fragment,I),Xt=s(I),Ye=d(I,"P",{"data-svelte-h":!0}),y(Ye)!=="svelte-1xcang8"&&(Ye.innerHTML=vn),Vt=s(I),h(V.$$.fragment,I),Gt=s(I),h(G.$$.fragment,I),Rt=s(I),h(R.$$.fragment,I),I.forEach(n),k.forEach(n),Tt=s(e),h(Ze.$$.fragment,e),vt=s(e),Ve=d(e,"P",{}),H(Ve).forEach(n),this.h()},h(){j(r,"name","hf:doc:metadata"),j(r,"content",Ln),j(v,"class","flex flex-wrap space-x-1"),kn(N.src,Kt="https://github.com/user-attachments/assets/c2cff209-b901-483c-87aa-774b82a0769f")||j(N,"src",Kt),j(N,"width","30%"),j(N,"height","40%"),j(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),j(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){c(document.head,r),o(e,M,t),o(e,m,t),o(e,p,t),f(T,e,t),o(e,i,t),o(e,v,t),o(e,Ge,t),o(e,Q,t),o(e,Re,t),o(e,P,t),o(e,Qe,t),f(E,e,t),o(e,Pe,t),o(e,A,t),o(e,Ee,t),o(e,N,t),o(e,Ae,t),f(D,e,t),o(e,De,t),f(O,e,t),o(e,Oe,t),o(e,K,t),o(e,Ke,t),f(ee,e,t),o(e,et,t),o(e,te,t),o(e,tt,t),f(ne,e,t),o(e,nt,t),o(e,oe,t),o(e,ot,t),o(e,ae,t),o(e,at,t),f(se,e,t),o(e,st,t),f(re,e,t),o(e,rt,t),f(ie,e,t),o(e,it,t),o(e,le,t),o(e,lt,t),o(e,de,t),o(e,dt,t),f(ce,e,t),o(e,ct,t),o(e,me,t),o(e,mt,t),f(pe,e,t),o(e,pt,t),o(e,ue,t),o(e,ut,t),f(he,e,t),o(e,ht,t),o(e,x,t),f(fe,x,null),c(x,kt),c(x,xe),c(x,Zt),c(x,ze),c(x,$t),c(x,je),o(e,ft,t),f(ge,e,t),o(e,gt,t),o(e,Z,t),f(_e,Z,null),c(Z,Ct),c(Z,Je),c(Z,xt),c(Z,Ue),c(Z,zt),c(Z,We),c(Z,jt),c(Z,q),f(be,q,null),c(q,Jt),c(q,Fe),c(q,Ut),f(Y,q,null),o(e,_t,t),f(ye,e,t),o(e,bt,t),o(e,L,t),f(Me,L,null),c(L,Wt),c(L,J),f(Te,J,null),c(J,Ft),c(J,qe),c(J,qt),f(S,J,null),c(J,It),f(X,J,null),o(e,yt,t),f(ve,e,t),o(e,Mt,t),o(e,w,t),f(we,w,null),c(w,Lt),c(w,Ie),c(w,Bt),c(w,Le),c(w,Ht),c(w,Be),c(w,Nt),c(w,He),c(w,Yt),c(w,Ne),c(w,St),c(w,C),f(ke,C,null),c(C,Xt),c(C,Ye),c(C,Vt),f(V,C,null),c(C,Gt),f(G,C,null),c(C,Rt),f(R,C,null),o(e,Tt,t),f(Ze,e,t),o(e,vt,t),o(e,Ve,t),wt=!0},p(e,[t]){const W={};t&2&&(W.$$scope={dirty:t,ctx:e}),Y.$set(W);const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),S.$set(z);const B={};t&2&&(B.$$scope={dirty:t,ctx:e}),X.$set(B);const $e={};t&2&&($e.$$scope={dirty:t,ctx:e}),V.$set($e);const F={};t&2&&(F.$$scope={dirty:t,ctx:e}),G.$set(F);const k={};t&2&&(k.$$scope={dirty:t,ctx:e}),R.$set(k)},i(e){wt||(g(T.$$.fragment,e),g(E.$$.fragment,e),g(D.$$.fragment,e),g(O.$$.fragment,e),g(ee.$$.fragment,e),g(ne.$$.fragment,e),g(se.$$.fragment,e),g(re.$$.fragment,e),g(ie.$$.fragment,e),g(ce.$$.fragment,e),g(pe.$$.fragment,e),g(he.$$.fragment,e),g(fe.$$.fragment,e),g(ge.$$.fragment,e),g(_e.$$.fragment,e),g(be.$$.fragment,e),g(Y.$$.fragment,e),g(ye.$$.fragment,e),g(Me.$$.fragment,e),g(Te.$$.fragment,e),g(S.$$.fragment,e),g(X.$$.fragment,e),g(ve.$$.fragment,e),g(we.$$.fragment,e),g(ke.$$.fragment,e),g(V.$$.fragment,e),g(G.$$.fragment,e),g(R.$$.fragment,e),g(Ze.$$.fragment,e),wt=!0)},o(e){_(T.$$.fragment,e),_(E.$$.fragment,e),_(D.$$.fragment,e),_(O.$$.fragment,e),_(ee.$$.fragment,e),_(ne.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),_(ie.$$.fragment,e),_(ce.$$.fragment,e),_(pe.$$.fragment,e),_(he.$$.fragment,e),_(fe.$$.fragment,e),_(ge.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_(Y.$$.fragment,e),_(ye.$$.fragment,e),_(Me.$$.fragment,e),_(Te.$$.fragment,e),_(S.$$.fragment,e),_(X.$$.fragment,e),_(ve.$$.fragment,e),_(we.$$.fragment,e),_(ke.$$.fragment,e),_(V.$$.fragment,e),_(G.$$.fragment,e),_(R.$$.fragment,e),_(Ze.$$.fragment,e),wt=!1},d(e){e&&(n(M),n(m),n(p),n(i),n(v),n(Ge),n(Q),n(Re),n(P),n(Qe),n(Pe),n(A),n(Ee),n(N),n(Ae),n(De),n(Oe),n(K),n(Ke),n(et),n(te),n(tt),n(nt),n(oe),n(ot),n(ae),n(at),n(st),n(rt),n(it),n(le),n(lt),n(de),n(dt),n(ct),n(me),n(mt),n(pt),n(ue),n(ut),n(ht),n(x),n(ft),n(gt),n(Z),n(_t),n(bt),n(L),n(yt),n(Mt),n(w),n(Tt),n(vt),n(Ve)),n(r),b(T,e),b(E,e),b(D,e),b(O,e),b(ee,e),b(ne,e),b(se,e),b(re,e),b(ie,e),b(ce,e),b(pe,e),b(he,e),b(fe),b(ge,e),b(_e),b(be),b(Y),b(ye,e),b(Me),b(Te),b(S),b(X),b(ve,e),b(we),b(ke),b(V),b(G),b(R),b(Ze,e)}}}const Ln='{"title":"Zamba","local":"zamba","sections":[{"title":"Model details","local":"model-details","sections":[],"depth":2},{"title":"Quick start","local":"quick-start","sections":[{"title":"Presequities","local":"presequities","sections":[],"depth":3}],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2},{"title":"Model card","local":"model-card","sections":[],"depth":2},{"title":"Issues","local":"issues","sections":[],"depth":2},{"title":"License","local":"license","sections":[],"depth":2},{"title":"ZambaConfig","local":"transformers.ZambaConfig","sections":[],"depth":2},{"title":"ZambaModel","local":"transformers.ZambaModel","sections":[],"depth":2},{"title":"ZambaForCausalLM","local":"transformers.ZambaForCausalLM","sections":[],"depth":2},{"title":"ZambaForSequenceClassification","local":"transformers.ZambaForSequenceClassification","sections":[],"depth":2}],"depth":1}';function Bn($){return Zn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qn extends $n{constructor(r){super(),Cn(this,r,Bn,In,wn,{})}}export{Qn as component};
