import{s as Ft,o as Vt,n as Se}from"../chunks/scheduler.bdbef820.js";import{S as Rt,i as Wt,g as l,s as n,r as f,A as Bt,h as d,f as o,c as s,j as le,u,x as p,k as de,y as m,a,v as g,d as b,t as _,w as M}from"../chunks/index.33f81d56.js";import{T as jt}from"../chunks/Tip.34194030.js";import{D as ye}from"../chunks/Docstring.662771b3.js";import{C as Pe}from"../chunks/CodeBlock.3bad7fc9.js";import{E as Zt}from"../chunks/ExampleCodeBlock.32707fc1.js";import{H as me,E as Lt}from"../chunks/index.e01163b6.js";function Qt(I){let r,J="Example:",c,h,T;return h=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1hbWJhMkNvbmZpZyUyQyUyME1hbWJhMk1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyME1hbWJhMiUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwTWFtYmEyQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGNvbmZpZ3VyYXRpb24lMEFtb2RlbCUyMCUzRCUyME1hbWJhMk1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Mamba2Config, Mamba2Model

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

<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 = Mamba2Model(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(){r=l("p"),r.textContent=J,c=n(),f(h.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),p(r)!=="svelte-11lpom8"&&(r.textContent=J),c=s(i),u(h.$$.fragment,i)},m(i,y){a(i,r,y),a(i,c,y),g(h,i,y),T=!0},p:Se,i(i){T||(b(h.$$.fragment,i),T=!0)},o(i){_(h.$$.fragment,i),T=!1},d(i){i&&(o(r),o(c)),M(h,i)}}}function Et(I){let r,J=`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=J},l(c){r=d(c,"P",{"data-svelte-h":!0}),p(r)!=="svelte-fincs2"&&(r.innerHTML=J)},m(c,h){a(c,r,h)},p:Se,d(c){c&&o(r)}}}function Ht(I){let r,J=`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=J},l(c){r=d(c,"P",{"data-svelte-h":!0}),p(r)!=="svelte-fincs2"&&(r.innerHTML=J)},m(c,h){a(c,r,h)},p:Se,d(c){c&&o(r)}}}function Nt(I){let r,J="Example:",c,h,T;return h=new Pe({props:{code:"",highlighted:"",wrap:!1}}),{c(){r=l("p"),r.textContent=J,c=n(),f(h.$$.fragment)},l(i){r=d(i,"P",{"data-svelte-h":!0}),p(r)!=="svelte-11lpom8"&&(r.textContent=J),c=s(i),u(h.$$.fragment,i)},m(i,y){a(i,r,y),a(i,c,y),g(h,i,y),T=!0},p:Se,i(i){T||(b(h.$$.fragment,i),T=!0)},o(i){_(h.$$.fragment,i),T=!1},d(i){i&&(o(r),o(c)),M(h,i)}}}function Xt(I){let r,J,c,h,T,i,y,we,B,ct='맘바2 모델은 Tri Dao, Albert Gu가 제안한 <a href="https://arxiv.org/abs/2405.21060" rel="nofollow">트랜스포머는 SSM이다: 구조화된 상태 공간 이중성을 통한 일반화된 모델과 효율적인 알고리즘</a>라는 논문에서 소개되었습니다. 맘바2는 맘바1과 유사한 상태 공간 모델로, 단순화된 아키텍처에서 더 나은 성능을 보입니다.',ve,L,pt="해당 논문의 초록입니다:",ke,Q,ht="<em>트랜스포머는 언어 모델링에서 딥러닝 성공의 주요 아키텍처였지만, 맘바와 같은 상태 공간 모델(SSM)이 최근 소규모 혹은 중간 규모에서 트랜스포머와 대등하거나 더 나은 성능을 보이는 것으로 나타났습니다. 우리는 이러한 모델 계열들이 실제로 매우 밀접하게 연관되어 있음을 파악했습니다. 그리고 구조화된 준분리(semiseparable) 행렬 중 연구가 잘 이루어진 클래스의 다양한 분해를 통해 연결된 SSM과 어텐션 변형 사이의 풍부한 이론적 연결 프레임워크를 개발했습니다. 상태 공간 이중성(SSD) 프레임워크를 통해 맘바1의 선택적 SSM을 개선한 새로운 아키텍처를 설계할 수 있었고, 트랜스포머와 경쟁력을 유지하면서도 속도는 2~8배 더 빠른 성능을 냅니다.</em>",Ce,E,ft="팁:",Ue,H,ut='이 버전은 맘바2 구현을 지원해야 하며, 특히 Mistral AI의 <a href="https://huggingface.co/mistralai/Mamba-Codestral-7B-v0.1" rel="nofollow">Mamba-2 codestral</a>을 지원합니다. 특히, mamba 2 codestral은 8개의 <code>groups</code>로 출시되었는데, 이는 어텐션 기반 모델의 KV 헤드 수와 유사하다고 판단 가능합니다.',$e,N,gt='이 모델은 <code>torch_forward</code>와 <code>cuda_kernels_forward</code>라는 두 가지 다른 전방 패스를 가집니다. <code>cuda_kernels_forward</code>는 환경에서 cuda 커널을 찾으면 이를 사용하며, prefill에서는 더 느립니다. 즉, 높은 CPU 오버헤드로 인해 “웜업 실행”이 필요하기 때문입니다. 관련 내용은 <a href="https://github.com/state-spaces/mamba/issues/389#issuecomment-2171755306" rel="nofollow">이곳</a>과 <a href="https://github.com/state-spaces/mamba/issues/355#issuecomment-2147597457" rel="nofollow">이곳</a>을 참고하세요.',xe,X,bt='컴파일 없이는 <code>torch_forward</code> 구현이 3~4배 빠릅니다. 또한, 이 모델에는 위치 임베딩이 없지만 <code>attention_mask</code>와 배치 생성의 경우 두 곳에서 은닉 상태(hidden state)를 마스킹하는 특정 로직이 있습니다. 관련 내용은 <a href="https://github.com/state-spaces/mamba/issues/66#issuecomment-1863563829" rel="nofollow">이곳</a>을 참고하세요.',Ie,D,_t="이로인해 맘바2 커널의 재구현과 함께 배치 생성 및 캐시된 생성에서 약간의 차이가 예상됩니다. 또한 cuda 커널 또는 torch forward가 제공하는 결과가 약간 다를 것으로 예상됩니다. SSM 알고리즘은 텐서 수축에 크게 의존하는데, 이는 matmul과 동등하지만 연산 순서가 약간 다르며, 이로 인해 더 작은 정밀도에서 차이가 더 커집니다.",ze,G,Mt="또 다른 참고사항으로, 패딩 토큰에 해당하는 은닉 상태(hidden state)의 종료는 두 곳에서 이루어지며 주로 왼쪽 패딩으로 테스트되었습니다. 오른쪽 패딩은 노이즈를 전파하므로 만족스러운 결과를 보장하지 않습니다. <code>tokenizer.padding_side = &quot;left&quot;</code>를 사용하면 올바른 패딩 방향을 사용할 수 있습니다.",je,P,Tt=`이 모델은 <a href="https://huggingface.co/Molbap" rel="nofollow">Molbap</a>이 기여했으며, <a href="https://github.com/vasqu" rel="nofollow">Anton Vlasjuk</a>의 큰 도움을 받았습니다.
원본 코드는 <a href="https://github.com/state-spaces/mamba" rel="nofollow">이곳</a>에서 확인할 수 있습니다.`,Ze,S,Fe,q,Ve,A,Re,O,Jt="이곳은 미세조정을 위한 초안 스크립트입니다:",We,Y,Be,K,Le,k,ee,qe,ce,yt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/ko/model_doc/mamba2#transformers.Mamba2Model">Mamba2Model</a>. It is used to instantiate a MAMBA2
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 MAMBA2
<a href="https://huggingface.co/state-spaces/mamba2-2.8b" rel="nofollow">state-spaces/mamba2-2.8b</a> architecture.`,Ae,pe,wt=`Configuration objects inherit from <a href="/docs/transformers/main/ko/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/ko/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Oe,Z,Qe,te,Ee,w,oe,Ye,he,vt="The bare Mamba2 Model outputting raw hidden-states without any specific head on top.",Ke,fe,kt=`This model inherits from <a href="/docs/transformers/main/ko/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.)`,et,ue,Ct=`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.`,tt,z,ae,ot,ge,Ut='The <a href="/docs/transformers/main/ko/model_doc/mamba2#transformers.Mamba2Model">Mamba2Model</a> forward method, overrides the <code>__call__</code> special method.',at,F,He,ne,Ne,v,se,nt,be,$t=`The MAMBA2 Model transformer with a language modeling head on top (linear layer with weights not tied to the input
embeddings).`,st,_e,xt=`This model inherits from <a href="/docs/transformers/main/ko/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.)`,rt,Me,It=`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.`,it,$,re,lt,Te,zt='The <a href="/docs/transformers/main/ko/model_doc/mamba2#transformers.Mamba2ForCausalLM">Mamba2ForCausalLM</a> forward method, overrides the <code>__call__</code> special method.',dt,V,mt,R,Xe,ie,De,Je,Ge;return T=new me({props:{title:"맘바2",local:"mamba-2",headingTag:"h1"}}),y=new me({props:{title:"개요",local:"overview",headingTag:"h2"}}),S=new me({props:{title:"사용",local:"사용",headingTag:"h1"}}),q=new me({props:{title:"간단한 생성 예:",local:"간단한-생성-예",headingTag:"h3"}}),A=new Pe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME1hbWJhMkNvbmZpZyUyQyUyME1hbWJhMkZvckNhdXNhbExNJTJDJTIwQXV0b1Rva2VuaXplciUwQWltcG9ydCUyMHRvcmNoJTBBbW9kZWxfaWQlMjAlM0QlMjAnbWlzdHJhbGFpJTJGTWFtYmEtQ29kZXN0cmFsLTdCLXYwLjEnJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjByZXZpc2lvbiUzRCdyZWZzJTJGcHIlMkY5JyUyQyUyMGZyb21fc2xvdyUzRFRydWUlMkMlMjBsZWdhY3klM0RGYWxzZSklMEFtb2RlbCUyMCUzRCUyME1hbWJhMkZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHJldmlzaW9uJTNEJ3JlZnMlMkZwciUyRjknKSUwQWlucHV0X2lkcyUyMCUzRCUyMHRva2VuaXplciglMjJIZXklMjBob3clMjBhcmUlMjB5b3UlMjBkb2luZyUzRiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIwJTIycHQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBb3V0JTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMCklMEFwcmludCh0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKG91dCkp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Mamba2Config, Mamba2ForCausalLM, AutoTokenizer
<span class="hljs-keyword">import</span> torch
model_id = <span class="hljs-string">&#x27;mistralai/Mamba-Codestral-7B-v0.1&#x27;</span>
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=<span class="hljs-string">&#x27;refs/pr/9&#x27;</span>, from_slow=<span class="hljs-literal">True</span>, legacy=<span class="hljs-literal">False</span>)
model = Mamba2ForCausalLM.from_pretrained(model_id, revision=<span class="hljs-string">&#x27;refs/pr/9&#x27;</span>)
input_ids = tokenizer(<span class="hljs-string">&quot;Hey how are you doing?&quot;</span>, return_tensors= <span class="hljs-string">&quot;pt&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]

out = model.generate(input_ids, max_new_tokens=<span class="hljs-number">10</span>)
<span class="hljs-built_in">print</span>(tokenizer.batch_decode(out))`,wrap:!1}}),Y=new Pe({props:{code:"ZnJvbSUyMHRybCUyMGltcG9ydCUyMFNGVFRyYWluZXIlMEFmcm9tJTIwcGVmdCUyMGltcG9ydCUyMExvcmFDb25maWclMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyME1hbWJhMkZvckNhdXNhbExNJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMEFtb2RlbF9pZCUyMCUzRCUyMCdtaXN0cmFsYWklMkZNYW1iYS1Db2Rlc3RyYWwtN0ItdjAuMSclMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHJldmlzaW9uJTNEJ3JlZnMlMkZwciUyRjknJTJDJTIwZnJvbV9zbG93JTNEVHJ1ZSUyQyUyMGxlZ2FjeSUzREZhbHNlKSUwQXRva2VuaXplci5wYWRfdG9rZW4lMjAlM0QlMjB0b2tlbml6ZXIuZW9zX3Rva2VuJTBBdG9rZW5pemVyLnBhZGRpbmdfc2lkZSUyMCUzRCUyMCUyMmxlZnQlMjIlMjAlMjMlRUMlOTklQkMlRUMlQUElQkQlMjAlRUQlOEMlQTglRUIlOTQlQTklRUMlOUMlQkMlRUIlQTElOUMlMjAlRUMlODQlQTQlRUMlQTAlOTUlMEElMEFtb2RlbCUyMCUzRCUyME1hbWJhMkZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHJldmlzaW9uJTNEJ3JlZnMlMkZwciUyRjknKSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyQWJpcmF0ZSUyRmVuZ2xpc2hfcXVvdGVzJTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiUyMiklMEElMjMlMjBDVURBJTIwJUVDJUJCJUE0JUVCJTg0JTkwJUVDJTk3JTg2JUVDJTlEJUI0JUVCJThBJTk0JTJDJTIwJUVCJUIwJUIwJUVDJUI5JTk4JUVEJTgxJUFDJUVBJUI4JUIwJTIwMiVFQSVCMCU4MCUyMDgwR0IlMjAlRUMlOUUlQTUlRUMlQjklOTglRUIlQTUlQkMlMjAlRUQlOTUlOTglRUIlODIlOTglMjAlRUMlQjAlQTglRUMlQTclODAlRUQlOTUlQTklRUIlOEIlODglRUIlOEIlQTQuJTBBJTIzJTIwJUVEJTk1JTk4JUVDJUE3JTgwJUVCJUE3JThDJTIwJUVDJUEwJTk1JUVEJTk5JTk1JUVCJThGJTg0JUVCJThBJTk0JTIwJUVBJUIwJTkwJUVDJTg2JThDJUVEJTk1JUE5JUVCJThCJTg4JUVCJThCJUE0LiUwQSUyMyUyMCVFQyU4QiVBNCVFRCU5NyU5OCVFQSVCMyVCQyUyMCVFQyU4QiU5QyVFQiU4RiU4NCVFQiVBNSVCQyUyMCVFRCU5OSU5OCVFQyU5OCU4MSVFRCU5NSVBOSVFQiU4QiU4OCVFQiU4QiVBNCElMEF0cmFpbmluZ19hcmdzJTIwJTNEJTIwVHJhaW5pbmdBcmd1bWVudHMoJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMi4lMkZyZXN1bHRzJTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX3RyYWluX2Vwb2NocyUzRDMlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QyJTJDJTBBJTIwJTIwJTIwJTIwbG9nZ2luZ19kaXIlM0QnLiUyRmxvZ3MnJTJDJTBBJTIwJTIwJTIwJTIwbG9nZ2luZ19zdGVwcyUzRDEwJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTMlMEEpJTBBbG9yYV9jb25maWclMjAlM0QlMjAlMjBMb3JhQ29uZmlnKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHIlM0Q4JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdGFyZ2V0X21vZHVsZXMlM0QlNUIlMjJlbWJlZGRpbmdzJTIyJTJDJTIwJTIyaW5fcHJvaiUyMiUyQyUyMCUyMm91dF9wcm9qJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdGFza190eXBlJTNEJTIyQ0FVU0FMX0xNJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYmlhcyUzRCUyMm5vbmUlMjIlMEEpJTBBdHJhaW5lciUyMCUzRCUyMFNGVFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwcGVmdF9jb25maWclM0Rsb3JhX2NvbmZpZyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RkYXRhc2V0JTJDJTBBJTIwJTIwJTIwJTIwZGF0YXNldF90ZXh0X2ZpZWxkJTNEJTIycXVvdGUlMjIlMkMlMEEpJTBBdHJhaW5lci50cmFpbigp",highlighted:`<span class="hljs-keyword">from</span> trl <span class="hljs-keyword">import</span> SFTTrainer
<span class="hljs-keyword">from</span> peft <span class="hljs-keyword">import</span> LoraConfig
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, Mamba2ForCausalLM, TrainingArguments
model_id = <span class="hljs-string">&#x27;mistralai/Mamba-Codestral-7B-v0.1&#x27;</span>
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=<span class="hljs-string">&#x27;refs/pr/9&#x27;</span>, from_slow=<span class="hljs-literal">True</span>, legacy=<span class="hljs-literal">False</span>)
tokenizer.pad_token = tokenizer.eos_token
tokenizer.padding_side = <span class="hljs-string">&quot;left&quot;</span> <span class="hljs-comment">#왼쪽 패딩으로 설정</span>

model = Mamba2ForCausalLM.from_pretrained(model_id, revision=<span class="hljs-string">&#x27;refs/pr/9&#x27;</span>)
dataset = load_dataset(<span class="hljs-string">&quot;Abirate/english_quotes&quot;</span>, split=<span class="hljs-string">&quot;train&quot;</span>)
<span class="hljs-comment"># CUDA 커널없이는, 배치크기 2가 80GB 장치를 하나 차지합니다.</span>
<span class="hljs-comment"># 하지만 정확도는 감소합니다.</span>
<span class="hljs-comment"># 실험과 시도를 환영합니다!</span>
training_args = TrainingArguments(
    output_dir=<span class="hljs-string">&quot;./results&quot;</span>,
    num_train_epochs=<span class="hljs-number">3</span>,
    per_device_train_batch_size=<span class="hljs-number">2</span>,
    logging_dir=<span class="hljs-string">&#x27;./logs&#x27;</span>,
    logging_steps=<span class="hljs-number">10</span>,
    learning_rate=<span class="hljs-number">2e-3</span>
)
lora_config =  LoraConfig(
        r=<span class="hljs-number">8</span>,
        target_modules=[<span class="hljs-string">&quot;embeddings&quot;</span>, <span class="hljs-string">&quot;in_proj&quot;</span>, <span class="hljs-string">&quot;out_proj&quot;</span>],
        task_type=<span class="hljs-string">&quot;CAUSAL_LM&quot;</span>,
        bias=<span class="hljs-string">&quot;none&quot;</span>
)
trainer = SFTTrainer(
    model=model,
    tokenizer=tokenizer,
    args=training_args,
    peft_config=lora_config,
    train_dataset=dataset,
    dataset_text_field=<span class="hljs-string">&quot;quote&quot;</span>,
)
trainer.train()`,wrap:!1}}),K=new me({props:{title:"Mamba2Config",local:"transformers.Mamba2Config",headingTag:"h2"}}),ee=new ye({props:{name:"class transformers.Mamba2Config",anchor:"transformers.Mamba2Config",parameters:[{name:"num_heads",val:" = 128"},{name:"head_dim",val:" = 64"},{name:"vocab_size",val:" = 32768"},{name:"hidden_size",val:" = 4096"},{name:"state_size",val:" = 128"},{name:"num_hidden_layers",val:" = 64"},{name:"layer_norm_epsilon",val:" = 1e-05"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"expand",val:" = 2"},{name:"conv_kernel",val:" = 4"},{name:"n_groups",val:" = 8"},{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_min",val:" = 0.001"},{name:"time_step_max",val:" = 0.1"},{name:"time_step_floor",val:" = 0.0001"},{name:"time_step_limit",val:" = (0.0, inf)"},{name:"rescale_prenorm_residual",val:" = False"},{name:"use_cache",val:" = True"},{name:"rms_norm",val:" = True"},{name:"chunk_size",val:" = 256"},{name:"tie_word_embeddings",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mamba2Config.num_heads",description:`<strong>num_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Number of heads for the evolution matrices of mamba 2.`,name:"num_heads"},{anchor:"transformers.Mamba2Config.head_dim",description:`<strong>head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimension of each head.`,name:"head_dim"},{anchor:"transformers.Mamba2Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32768) &#x2014;
Vocabulary size of the MAMBA2 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/ko/model_doc/mamba2#transformers.Mamba2Model">Mamba2Model</a>.`,name:"vocab_size"},{anchor:"transformers.Mamba2Config.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the embeddings and hidden states.`,name:"hidden_size"},{anchor:"transformers.Mamba2Config.state_size",description:"<strong>state_size</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014; shape of the state space latents.",name:"state_size"},{anchor:"transformers.Mamba2Config.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of hidden layers in the model.`,name:"num_hidden_layers"},{anchor:"transformers.Mamba2Config.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.Mamba2Config.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Padding token id.`,name:"pad_token_id"},{anchor:"transformers.Mamba2Config.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.Mamba2Config.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The id of the end of sentence token in the vocabulary.`,name:"eos_token_id"},{anchor:"transformers.Mamba2Config.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.Mamba2Config.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.Mamba2Config.n_groups",description:`<strong>n_groups</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of groups for the evolution matrices of mamba 2.`,name:"n_groups"},{anchor:"transformers.Mamba2Config.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.Mamba2Config.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.Mamba2Config.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.Mamba2Config.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.Mamba2Config.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.Mamba2Config.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.Mamba2Config.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.Mamba2Config.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.Mamba2Config.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.Mamba2Config.time_step_limit",description:`<strong>time_step_limit</strong> (<code>tuple</code>, <em>optional</em>, defaults to <code>(0.0, inf)</code>) &#x2014;
Accepted range of time step values.`,name:"time_step_limit"},{anchor:"transformers.Mamba2Config.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.Mamba2Config.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.Mamba2Config.rms_norm",description:`<strong>rms_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use RMS norm or not.`,name:"rms_norm"},{anchor:"transformers.Mamba2Config.chunk_size",description:`<strong>chunk_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Size of the chunks that will comprise the sequence.`,name:"chunk_size"},{anchor:"transformers.Mamba2Config.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie word embeddings or not.`,name:"tie_word_embeddings"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mamba2/configuration_mamba2.py#L26"}}),Z=new Zt({props:{anchor:"transformers.Mamba2Config.example",$$slots:{default:[Qt]},$$scope:{ctx:I}}}),te=new me({props:{title:"Mamba2Model",local:"transformers.Mamba2Model",headingTag:"h2"}}),oe=new ye({props:{name:"class transformers.Mamba2Model",anchor:"transformers.Mamba2Model",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Mamba2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/ko/model_doc/mamba2#transformers.Mamba2Model">Mamba2Model</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/ko/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/mamba2/modeling_mamba2.py#L819"}}),ae=new ye({props:{name:"forward",anchor:"transformers.Mamba2Model.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.models.mamba2.modeling_mamba2.Mamba2Cache] = 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.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mamba2Model.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/ko/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/ko/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/ko/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.Mamba2Model.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.LongTensor</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.Mamba2Model.forward.cache_params",description:`<strong>cache_params</strong> (<code>~models.mamba2.modeling_mamba2.Mamba2Cache</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.Mamba2Model.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.Mamba2Model.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.Mamba2Model.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/ko/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Mamba2Model.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
The position of the current input in the cache. This is used to ensure that the cache is correctly updated.
If <code>cache_params</code> is passed, <code>cache_position</code> should also be passed.`,name:"cache_position"},{anchor:"transformers.Mamba2Model.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mamba2/modeling_mamba2.py#L845",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.mamba2.modeling_mamba2.Mamba2Output</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/ko/model_doc/mamba2#transformers.Mamba2Config"
>Mamba2Config</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>Mamba2Cache</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.mamba2.modeling_mamba2.Mamba2Output</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),F=new jt({props:{$$slots:{default:[Et]},$$scope:{ctx:I}}}),ne=new me({props:{title:"Mamba2LMHeadModel",local:"transformers.Mamba2ForCausalLM",headingTag:"h2"}}),se=new ye({props:{name:"class transformers.Mamba2ForCausalLM",anchor:"transformers.Mamba2ForCausalLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Mamba2ForCausalLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/ko/model_doc/mamba2#transformers.Mamba2ForCausalLM">Mamba2ForCausalLM</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/ko/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/mamba2/modeling_mamba2.py#L934"}}),re=new ye({props:{name:"forward",anchor:"transformers.Mamba2ForCausalLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"cache_params",val:": typing.Optional[transformers.models.mamba2.modeling_mamba2.Mamba2Cache] = 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:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Mamba2ForCausalLM.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/ko/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/ko/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/ko/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.Mamba2ForCausalLM.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.Mamba2ForCausalLM.forward.cache_params",description:`<strong>cache_params</strong> (<code>~models.mamba2.modeling_mamba2.Mamba2Cache</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.Mamba2ForCausalLM.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"},{anchor:"transformers.Mamba2ForCausalLM.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.Mamba2ForCausalLM.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/ko/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.Mamba2ForCausalLM.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.Mamba2ForCausalLM.forward.cache_position",description:`<strong>cache_position</strong> (<code>torch.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
The position of the current input in the cache. This is used to ensure that the cache is correctly updated.
If <code>cache_params</code> is passed, <code>cache_position</code> should also be passed.`,name:"cache_position"},{anchor:"transformers.Mamba2ForCausalLM.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/mamba2/modeling_mamba2.py#L1009",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.mamba2.modeling_mamba2.Mamba2CausalLMOutput</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/ko/model_doc/mamba2#transformers.Mamba2Config"
>Mamba2Config</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>Mamba2Cache</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.mamba2.modeling_mamba2.Mamba2CausalLMOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),V=new jt({props:{$$slots:{default:[Ht]},$$scope:{ctx:I}}}),R=new Zt({props:{anchor:"transformers.Mamba2ForCausalLM.forward.example",$$slots:{default:[Nt]},$$scope:{ctx:I}}}),ie=new Lt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/model_doc/mamba2.md"}}),{c(){r=l("meta"),J=n(),c=l("p"),h=n(),f(T.$$.fragment),i=n(),f(y.$$.fragment),we=n(),B=l("p"),B.innerHTML=ct,ve=n(),L=l("p"),L.textContent=pt,ke=n(),Q=l("p"),Q.innerHTML=ht,Ce=n(),E=l("p"),E.textContent=ft,Ue=n(),H=l("p"),H.innerHTML=ut,$e=n(),N=l("p"),N.innerHTML=gt,xe=n(),X=l("p"),X.innerHTML=bt,Ie=n(),D=l("p"),D.textContent=_t,ze=n(),G=l("p"),G.innerHTML=Mt,je=n(),P=l("p"),P.innerHTML=Tt,Ze=n(),f(S.$$.fragment),Fe=n(),f(q.$$.fragment),Ve=n(),f(A.$$.fragment),Re=n(),O=l("p"),O.textContent=Jt,We=n(),f(Y.$$.fragment),Be=n(),f(K.$$.fragment),Le=n(),k=l("div"),f(ee.$$.fragment),qe=n(),ce=l("p"),ce.innerHTML=yt,Ae=n(),pe=l("p"),pe.innerHTML=wt,Oe=n(),f(Z.$$.fragment),Qe=n(),f(te.$$.fragment),Ee=n(),w=l("div"),f(oe.$$.fragment),Ye=n(),he=l("p"),he.textContent=vt,Ke=n(),fe=l("p"),fe.innerHTML=kt,et=n(),ue=l("p"),ue.innerHTML=Ct,tt=n(),z=l("div"),f(ae.$$.fragment),ot=n(),ge=l("p"),ge.innerHTML=Ut,at=n(),f(F.$$.fragment),He=n(),f(ne.$$.fragment),Ne=n(),v=l("div"),f(se.$$.fragment),nt=n(),be=l("p"),be.textContent=$t,st=n(),_e=l("p"),_e.innerHTML=xt,rt=n(),Me=l("p"),Me.innerHTML=It,it=n(),$=l("div"),f(re.$$.fragment),lt=n(),Te=l("p"),Te.innerHTML=zt,dt=n(),f(V.$$.fragment),mt=n(),f(R.$$.fragment),Xe=n(),f(ie.$$.fragment),De=n(),Je=l("p"),this.h()},l(e){const t=Bt("svelte-u9bgzb",document.head);r=d(t,"META",{name:!0,content:!0}),t.forEach(o),J=s(e),c=d(e,"P",{}),le(c).forEach(o),h=s(e),u(T.$$.fragment,e),i=s(e),u(y.$$.fragment,e),we=s(e),B=d(e,"P",{"data-svelte-h":!0}),p(B)!=="svelte-13sb336"&&(B.innerHTML=ct),ve=s(e),L=d(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-un5jih"&&(L.textContent=pt),ke=s(e),Q=d(e,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-tmp2gx"&&(Q.innerHTML=ht),Ce=s(e),E=d(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-k6v9m1"&&(E.textContent=ft),Ue=s(e),H=d(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-fhnyac"&&(H.innerHTML=ut),$e=s(e),N=d(e,"P",{"data-svelte-h":!0}),p(N)!=="svelte-k5mues"&&(N.innerHTML=gt),xe=s(e),X=d(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-1cm0lmb"&&(X.innerHTML=bt),Ie=s(e),D=d(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-1sogc1t"&&(D.textContent=_t),ze=s(e),G=d(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-c8fxzm"&&(G.innerHTML=Mt),je=s(e),P=d(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-75idyi"&&(P.innerHTML=Tt),Ze=s(e),u(S.$$.fragment,e),Fe=s(e),u(q.$$.fragment,e),Ve=s(e),u(A.$$.fragment,e),Re=s(e),O=d(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-4nej7c"&&(O.textContent=Jt),We=s(e),u(Y.$$.fragment,e),Be=s(e),u(K.$$.fragment,e),Le=s(e),k=d(e,"DIV",{class:!0});var x=le(k);u(ee.$$.fragment,x),qe=s(x),ce=d(x,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-1ffb1ma"&&(ce.innerHTML=yt),Ae=s(x),pe=d(x,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-qr3t5r"&&(pe.innerHTML=wt),Oe=s(x),u(Z.$$.fragment,x),x.forEach(o),Qe=s(e),u(te.$$.fragment,e),Ee=s(e),w=d(e,"DIV",{class:!0});var C=le(w);u(oe.$$.fragment,C),Ye=s(C),he=d(C,"P",{"data-svelte-h":!0}),p(he)!=="svelte-ey9rgy"&&(he.textContent=vt),Ke=s(C),fe=d(C,"P",{"data-svelte-h":!0}),p(fe)!=="svelte-u3dlub"&&(fe.innerHTML=kt),et=s(C),ue=d(C,"P",{"data-svelte-h":!0}),p(ue)!=="svelte-hswkmf"&&(ue.innerHTML=Ct),tt=s(C),z=d(C,"DIV",{class:!0});var j=le(z);u(ae.$$.fragment,j),ot=s(j),ge=d(j,"P",{"data-svelte-h":!0}),p(ge)!=="svelte-1fo7zso"&&(ge.innerHTML=Ut),at=s(j),u(F.$$.fragment,j),j.forEach(o),C.forEach(o),He=s(e),u(ne.$$.fragment,e),Ne=s(e),v=d(e,"DIV",{class:!0});var U=le(v);u(se.$$.fragment,U),nt=s(U),be=d(U,"P",{"data-svelte-h":!0}),p(be)!=="svelte-14gyjie"&&(be.textContent=$t),st=s(U),_e=d(U,"P",{"data-svelte-h":!0}),p(_e)!=="svelte-u3dlub"&&(_e.innerHTML=xt),rt=s(U),Me=d(U,"P",{"data-svelte-h":!0}),p(Me)!=="svelte-hswkmf"&&(Me.innerHTML=It),it=s(U),$=d(U,"DIV",{class:!0});var W=le($);u(re.$$.fragment,W),lt=s(W),Te=d(W,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-1k9l2ic"&&(Te.innerHTML=zt),dt=s(W),u(V.$$.fragment,W),mt=s(W),u(R.$$.fragment,W),W.forEach(o),U.forEach(o),Xe=s(e),u(ie.$$.fragment,e),De=s(e),Je=d(e,"P",{}),le(Je).forEach(o),this.h()},h(){de(r,"name","hf:doc:metadata"),de(r,"content",Dt),de(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),de(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),de(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),de($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),de(v,"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){m(document.head,r),a(e,J,t),a(e,c,t),a(e,h,t),g(T,e,t),a(e,i,t),g(y,e,t),a(e,we,t),a(e,B,t),a(e,ve,t),a(e,L,t),a(e,ke,t),a(e,Q,t),a(e,Ce,t),a(e,E,t),a(e,Ue,t),a(e,H,t),a(e,$e,t),a(e,N,t),a(e,xe,t),a(e,X,t),a(e,Ie,t),a(e,D,t),a(e,ze,t),a(e,G,t),a(e,je,t),a(e,P,t),a(e,Ze,t),g(S,e,t),a(e,Fe,t),g(q,e,t),a(e,Ve,t),g(A,e,t),a(e,Re,t),a(e,O,t),a(e,We,t),g(Y,e,t),a(e,Be,t),g(K,e,t),a(e,Le,t),a(e,k,t),g(ee,k,null),m(k,qe),m(k,ce),m(k,Ae),m(k,pe),m(k,Oe),g(Z,k,null),a(e,Qe,t),g(te,e,t),a(e,Ee,t),a(e,w,t),g(oe,w,null),m(w,Ye),m(w,he),m(w,Ke),m(w,fe),m(w,et),m(w,ue),m(w,tt),m(w,z),g(ae,z,null),m(z,ot),m(z,ge),m(z,at),g(F,z,null),a(e,He,t),g(ne,e,t),a(e,Ne,t),a(e,v,t),g(se,v,null),m(v,nt),m(v,be),m(v,st),m(v,_e),m(v,rt),m(v,Me),m(v,it),m(v,$),g(re,$,null),m($,lt),m($,Te),m($,dt),g(V,$,null),m($,mt),g(R,$,null),a(e,Xe,t),g(ie,e,t),a(e,De,t),a(e,Je,t),Ge=!0},p(e,[t]){const x={};t&2&&(x.$$scope={dirty:t,ctx:e}),Z.$set(x);const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),F.$set(C);const j={};t&2&&(j.$$scope={dirty:t,ctx:e}),V.$set(j);const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),R.$set(U)},i(e){Ge||(b(T.$$.fragment,e),b(y.$$.fragment,e),b(S.$$.fragment,e),b(q.$$.fragment,e),b(A.$$.fragment,e),b(Y.$$.fragment,e),b(K.$$.fragment,e),b(ee.$$.fragment,e),b(Z.$$.fragment,e),b(te.$$.fragment,e),b(oe.$$.fragment,e),b(ae.$$.fragment,e),b(F.$$.fragment,e),b(ne.$$.fragment,e),b(se.$$.fragment,e),b(re.$$.fragment,e),b(V.$$.fragment,e),b(R.$$.fragment,e),b(ie.$$.fragment,e),Ge=!0)},o(e){_(T.$$.fragment,e),_(y.$$.fragment,e),_(S.$$.fragment,e),_(q.$$.fragment,e),_(A.$$.fragment,e),_(Y.$$.fragment,e),_(K.$$.fragment,e),_(ee.$$.fragment,e),_(Z.$$.fragment,e),_(te.$$.fragment,e),_(oe.$$.fragment,e),_(ae.$$.fragment,e),_(F.$$.fragment,e),_(ne.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),_(V.$$.fragment,e),_(R.$$.fragment,e),_(ie.$$.fragment,e),Ge=!1},d(e){e&&(o(J),o(c),o(h),o(i),o(we),o(B),o(ve),o(L),o(ke),o(Q),o(Ce),o(E),o(Ue),o(H),o($e),o(N),o(xe),o(X),o(Ie),o(D),o(ze),o(G),o(je),o(P),o(Ze),o(Fe),o(Ve),o(Re),o(O),o(We),o(Be),o(Le),o(k),o(Qe),o(Ee),o(w),o(He),o(Ne),o(v),o(Xe),o(De),o(Je)),o(r),M(T,e),M(y,e),M(S,e),M(q,e),M(A,e),M(Y,e),M(K,e),M(ee),M(Z),M(te,e),M(oe),M(ae),M(F),M(ne,e),M(se),M(re),M(V),M(R),M(ie,e)}}}const Dt='{"title":"맘바2","local":"mamba-2","sections":[{"title":"개요","local":"overview","sections":[],"depth":2}],"depth":1}';function Gt(I){return Vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class eo extends Rt{constructor(r){super(),Wt(this,r,Gt,Xt,Ft,{})}}export{eo as component};
