import{s as _e,n as Te,o as be}from"../chunks/scheduler.bdbef820.js";import{S as $e,i as ve,g as c,s as o,r as S,A as we,h as s,f as t,c as n,j as q,u as D,x as m,k as z,y as i,a,v as W,d as k,t as j,w as A}from"../chunks/index.33f81d56.js";import{D as ce}from"../chunks/Docstring.b3df4217.js";import{H as ge,E as Ee}from"../chunks/index.474b463a.js";function Me(se){let l,N,I,V,x,F,g,ie='<a href="https://github.com/pytorch/executorch" rel="nofollow"><code>ExecuTorch</code></a> 는 웨어러블, 임베디드 장치, 마이크로컨트롤러를 포함한 모바일 및 엣지 장치에서 온디바이스 추론 기능을 가능하게 하는 종합 솔루션입니다. PyTorch 생태계에 속해있으며, 이식성, 생산성, 성능에 중점을 둔 PyTorch 모델 배포를 지원합니다.',G,_,de='ExecuTorch는 백엔드 위임, 사용자 정의 컴파일러 변환, 메모리 계획 등 모델, 장치 또는 특정 유즈케이스 맞춤 최적화를 수행할 수 있는 진입점을 명확하게 정의합니다. ExecuTorch를 사용해 엣지 장치에서 PyTorch 모델을 실행하는 첫 번째 단계는 모델을 익스포트하는 것입니다. 이 작업은 PyTorch API인 <a href="https://pytorch.org/docs/stable/export.html" rel="nofollow"><code>torch.export</code></a>를 사용하여 수행합니다.',R,T,U,b,pe="<code>torch.export</code>를 사용하여 🤗 Transformers를 익스포트 할 수 있도록  통합 지점이 개발되고 있습니다. 이 통합의 목표는 익스포트뿐만 아니라, 익스포트한 아티팩트가 <code>ExecuTorch</code>에서 효율적으로 실행될 수 있도록 더 축소하고 최적화하는 것입니다. 특히 모바일 및 엣지 유즈케이스에 중점을 두고 있습니다.",B,d,$,Z,M,le=`A wrapper module designed to make a <code>PreTrainedModel</code> exportable with <code>torch.export</code>,
specifically for use with static caching. This module ensures that the exported model
is compatible with further lowering and execution in <code>ExecuTorch</code>.`,ee,y,he=`Note:
This class is specifically designed to support export process using <code>torch.export</code>
in a way that ensures the model can be further lowered and run efficiently in <code>ExecuTorch</code>.`,te,p,v,re,C,me="Forward pass of the module, which is compatible with the ExecuTorch runtime.",oe,P,ue="This forward adapter serves two primary purposes:",ne,L,fe=`<li><p><strong>Making the Model <code>torch.export</code>-Compatible</strong>:
The adapter hides unsupported objects, such as the <code>Cache</code>, from the graph inputs and outputs,
enabling the model to be exportable using <code>torch.export</code> without encountering issues.</p></li> <li><p><strong>Ensuring Compatibility with <code>ExecuTorch</code> runtime</strong>:
The adapter matches the model’s forward signature with that in <code>executorch/extension/llm/runner</code>,
ensuring that the exported model can be executed in <code>ExecuTorch</code> out-of-the-box.</p></li>`,J,h,w,ae,H,xe=`Convert a <code>PreTrainedModel</code> into an exportable module and export it using <code>torch.export</code>,
ensuring the exported model is compatible with <code>ExecuTorch</code>.`,K,E,Q,O,X;return x=new ge({props:{title:"ExecuTorch",local:"executorch",headingTag:"h1"}}),T=new ge({props:{title:"ExecuTorch 통합",local:"transformers.TorchExportableModuleWithStaticCache ][ transformers.TorchExportableModuleWithStaticCache",headingTag:"h2"}}),$=new ce({props:{name:"class transformers.TorchExportableModuleWithStaticCache",anchor:"transformers.TorchExportableModuleWithStaticCache",parameters:[{name:"model",val:": PreTrainedModel"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/executorch.py#L27"}}),v=new ce({props:{name:"forward",anchor:"transformers.TorchExportableModuleWithStaticCache.forward",parameters:[{name:"input_ids",val:": Tensor"},{name:"cache_position",val:": Tensor"}],parametersDescription:[{anchor:"transformers.TorchExportableModuleWithStaticCache.forward.input_ids",description:"<strong>input_ids</strong> (<code>torch.Tensor</code>) &#x2014; Tensor representing current input token id to the module.",name:"input_ids"},{anchor:"transformers.TorchExportableModuleWithStaticCache.forward.cache_position",description:"<strong>cache_position</strong> (<code>torch.Tensor</code>) &#x2014; Tensor representing current input position in the cache.",name:"cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/executorch.py#L94",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Logits output from the model.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>torch.Tensor</p>
`}}),w=new ce({props:{name:"transformers.convert_and_export_with_cache",anchor:"transformers.convert_and_export_with_cache",parameters:[{name:"model",val:": PreTrainedModel"},{name:"example_input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"example_cache_position",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.convert_and_export_with_cache.model",description:"<strong>model</strong> (<code>PreTrainedModel</code>) &#x2014; The pretrained model to be exported.",name:"model"},{anchor:"transformers.convert_and_export_with_cache.example_input_ids",description:"<strong>example_input_ids</strong> (<code>torch.Tensor</code>) &#x2014; Example input token id used by <code>torch.export</code>.",name:"example_input_ids"},{anchor:"transformers.convert_and_export_with_cache.example_cache_position",description:"<strong>example_cache_position</strong> (<code>torch.Tensor</code>) &#x2014; Example current cache position used by <code>torch.export</code>.",name:"example_cache_position"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/integrations/executorch.py#L181",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The exported program generated via <code>torch.export</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Exported program (<code>torch.export.ExportedProgram</code>)</p>
`}}),E=new Ee({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/main_classes/executorch.md"}}),{c(){l=c("meta"),N=o(),I=c("p"),V=o(),S(x.$$.fragment),F=o(),g=c("p"),g.innerHTML=ie,G=o(),_=c("p"),_.innerHTML=de,R=o(),S(T.$$.fragment),U=o(),b=c("p"),b.innerHTML=pe,B=o(),d=c("div"),S($.$$.fragment),Z=o(),M=c("p"),M.innerHTML=le,ee=o(),y=c("p"),y.innerHTML=he,te=o(),p=c("div"),S(v.$$.fragment),re=o(),C=c("p"),C.textContent=me,oe=o(),P=c("p"),P.textContent=ue,ne=o(),L=c("ol"),L.innerHTML=fe,J=o(),h=c("div"),S(w.$$.fragment),ae=o(),H=c("p"),H.innerHTML=xe,K=o(),S(E.$$.fragment),Q=o(),O=c("p"),this.h()},l(e){const r=we("svelte-u9bgzb",document.head);l=s(r,"META",{name:!0,content:!0}),r.forEach(t),N=n(e),I=s(e,"P",{}),q(I).forEach(t),V=n(e),D(x.$$.fragment,e),F=n(e),g=s(e,"P",{"data-svelte-h":!0}),m(g)!=="svelte-d8am0z"&&(g.innerHTML=ie),G=n(e),_=s(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-14rqajo"&&(_.innerHTML=de),R=n(e),D(T.$$.fragment,e),U=n(e),b=s(e,"P",{"data-svelte-h":!0}),m(b)!=="svelte-w90j9f"&&(b.innerHTML=pe),B=n(e),d=s(e,"DIV",{class:!0});var u=q(d);D($.$$.fragment,u),Z=n(u),M=s(u,"P",{"data-svelte-h":!0}),m(M)!=="svelte-2k5iuq"&&(M.innerHTML=le),ee=n(u),y=s(u,"P",{"data-svelte-h":!0}),m(y)!=="svelte-sxfggh"&&(y.innerHTML=he),te=n(u),p=s(u,"DIV",{class:!0});var f=q(p);D(v.$$.fragment,f),re=n(f),C=s(f,"P",{"data-svelte-h":!0}),m(C)!=="svelte-1b4e8fi"&&(C.textContent=me),oe=n(f),P=s(f,"P",{"data-svelte-h":!0}),m(P)!=="svelte-15fkaet"&&(P.textContent=ue),ne=n(f),L=s(f,"OL",{"data-svelte-h":!0}),m(L)!=="svelte-ezgyom"&&(L.innerHTML=fe),f.forEach(t),u.forEach(t),J=n(e),h=s(e,"DIV",{class:!0});var Y=q(h);D(w.$$.fragment,Y),ae=n(Y),H=s(Y,"P",{"data-svelte-h":!0}),m(H)!=="svelte-2axmlh"&&(H.innerHTML=xe),Y.forEach(t),K=n(e),D(E.$$.fragment,e),Q=n(e),O=s(e,"P",{}),q(O).forEach(t),this.h()},h(){z(l,"name","hf:doc:metadata"),z(l,"content",ye),z(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(h,"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,r){i(document.head,l),a(e,N,r),a(e,I,r),a(e,V,r),W(x,e,r),a(e,F,r),a(e,g,r),a(e,G,r),a(e,_,r),a(e,R,r),W(T,e,r),a(e,U,r),a(e,b,r),a(e,B,r),a(e,d,r),W($,d,null),i(d,Z),i(d,M),i(d,ee),i(d,y),i(d,te),i(d,p),W(v,p,null),i(p,re),i(p,C),i(p,oe),i(p,P),i(p,ne),i(p,L),a(e,J,r),a(e,h,r),W(w,h,null),i(h,ae),i(h,H),a(e,K,r),W(E,e,r),a(e,Q,r),a(e,O,r),X=!0},p:Te,i(e){X||(k(x.$$.fragment,e),k(T.$$.fragment,e),k($.$$.fragment,e),k(v.$$.fragment,e),k(w.$$.fragment,e),k(E.$$.fragment,e),X=!0)},o(e){j(x.$$.fragment,e),j(T.$$.fragment,e),j($.$$.fragment,e),j(v.$$.fragment,e),j(w.$$.fragment,e),j(E.$$.fragment,e),X=!1},d(e){e&&(t(N),t(I),t(V),t(F),t(g),t(G),t(_),t(R),t(U),t(b),t(B),t(d),t(J),t(h),t(K),t(Q),t(O)),t(l),A(x,e),A(T,e),A($),A(v),A(w),A(E,e)}}}const ye='{"title":"ExecuTorch","local":"executorch","sections":[{"title":"ExecuTorch 통합","local":"transformers.TorchExportableModuleWithStaticCache ][ transformers.TorchExportableModuleWithStaticCache","sections":[],"depth":2}],"depth":1}';function Ce(se){return be(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class De extends $e{constructor(l){super(),ve(this,l,Ce,Me,_e,{})}}export{De as component};
