import{s as R,n as j,o as z}from"../chunks/scheduler.defa9a21.js";import{S as B,i as V,g as h,s as p,r as A,A as W,h as g,f as a,c as o,j as O,u as L,x as q,k as N,y as D,a as n,v as E,d as H,t as M,w as U}from"../chunks/index.fe795e71.js";import{D as J}from"../chunks/Docstring.90d6fe5c.js";import{H as F,E as K}from"../chunks/getInferenceSnippets.2234a8dd.js";function Q(I){let s,y,f,$,i,b,l,S='Accelerate supports pipeline parallelism for large-scale training with the PyTorch <a href="https://pytorch.org/docs/stable/distributed.pipelining.html" rel="nofollow">torch.distributed.pipelining</a> API.',x,c,w,r,m,G,u,C="Wraps <code>model</code> for pipeline parallel inference.",v,d,P,_,k;return i=new F({props:{title:"Pipeline parallelism",local:"pipeline-parallelism",headingTag:"h1"}}),c=new F({props:{title:"prepare_pippy",local:"accelerate.prepare_pippy",headingTag:"h2"}}),m=new J({props:{name:"accelerate.prepare_pippy",anchor:"accelerate.prepare_pippy",parameters:[{name:"model",val:""},{name:"split_points",val:": typing.Union[str, list[str], NoneType] = 'auto'"},{name:"no_split_module_classes",val:": typing.Optional[list[str]] = None"},{name:"example_args",val:": typing.Optional[tuple[typing.Any]] = ()"},{name:"example_kwargs",val:": typing.Optional[dict[str, typing.Any]] = None"},{name:"num_chunks",val:": typing.Optional[int] = None"},{name:"gather_output",val:": typing.Optional[bool] = False"}],parametersDescription:[{anchor:"accelerate.prepare_pippy.model",description:`<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014;
A model we want to split for pipeline-parallel inference`,name:"model"},{anchor:"accelerate.prepare_pippy.split_points",description:`<strong>split_points</strong> (<code>str</code> or <code>List[str]</code>, defaults to &#x2018;auto&#x2019;) &#x2014;
How to generate the split points and chunk the model across each GPU. &#x2018;auto&#x2019; will find the best balanced
split given any model. Should be a list of layer names in the model to split by otherwise.`,name:"split_points"},{anchor:"accelerate.prepare_pippy.no_split_module_classes",description:`<strong>no_split_module_classes</strong> (<code>List[str]</code>) &#x2014;
A list of class names for layers we don&#x2019;t want to be split.`,name:"no_split_module_classes"},{anchor:"accelerate.prepare_pippy.example_args",description:`<strong>example_args</strong> (tuple of model inputs) &#x2014;
The expected inputs for the model that uses order-based inputs for a <em>single process</em>. Recommended to use
this method if possible.`,name:"example_args"},{anchor:"accelerate.prepare_pippy.example_kwargs",description:`<strong>example_kwargs</strong> (dict of model inputs) &#x2014;
The expected inputs for the model that uses dictionary-based inputs for a <em>single process</em>. This is a
<em>highly</em> limiting structure that requires the same keys be present at <em>all</em> inference calls. Not
recommended unless the prior condition is true for all cases.`,name:"example_kwargs"},{anchor:"accelerate.prepare_pippy.num_chunks",description:`<strong>num_chunks</strong> (<code>int</code>, defaults to the number of available GPUs) &#x2014;
The number of different stages the Pipeline will have. By default it will assign one chunk per GPU, but
this can be tuned and played with. In general one should have num_chunks &gt;= num_gpus.`,name:"num_chunks"},{anchor:"accelerate.prepare_pippy.gather_output",description:`<strong>gather_output</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the output from the last GPU (which holds the true outputs) is sent across to all GPUs.`,name:"gather_output"}],source:"https://github.com/huggingface/accelerate/blob/v1.10.1/src/accelerate/inference.py#L124"}}),d=new K({props:{source:"https://github.com/huggingface/accelerate/blob/main/docs/source/package_reference/inference.md"}}),{c(){s=h("meta"),y=p(),f=h("p"),$=p(),A(i.$$.fragment),b=p(),l=h("p"),l.innerHTML=S,x=p(),A(c.$$.fragment),w=p(),r=h("div"),A(m.$$.fragment),G=p(),u=h("p"),u.innerHTML=C,v=p(),A(d.$$.fragment),P=p(),_=h("p"),this.h()},l(e){const t=W("svelte-u9bgzb",document.head);s=g(t,"META",{name:!0,content:!0}),t.forEach(a),y=o(e),f=g(e,"P",{}),O(f).forEach(a),$=o(e),L(i.$$.fragment,e),b=o(e),l=g(e,"P",{"data-svelte-h":!0}),q(l)!=="svelte-mnc17l"&&(l.innerHTML=S),x=o(e),L(c.$$.fragment,e),w=o(e),r=g(e,"DIV",{class:!0});var T=O(r);L(m.$$.fragment,T),G=o(T),u=g(T,"P",{"data-svelte-h":!0}),q(u)!=="svelte-1pc33ak"&&(u.innerHTML=C),T.forEach(a),v=o(e),L(d.$$.fragment,e),P=o(e),_=g(e,"P",{}),O(_).forEach(a),this.h()},h(){N(s,"name","hf:doc:metadata"),N(s,"content",X),N(r,"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){D(document.head,s),n(e,y,t),n(e,f,t),n(e,$,t),E(i,e,t),n(e,b,t),n(e,l,t),n(e,x,t),E(c,e,t),n(e,w,t),n(e,r,t),E(m,r,null),D(r,G),D(r,u),n(e,v,t),E(d,e,t),n(e,P,t),n(e,_,t),k=!0},p:j,i(e){k||(H(i.$$.fragment,e),H(c.$$.fragment,e),H(m.$$.fragment,e),H(d.$$.fragment,e),k=!0)},o(e){M(i.$$.fragment,e),M(c.$$.fragment,e),M(m.$$.fragment,e),M(d.$$.fragment,e),k=!1},d(e){e&&(a(y),a(f),a($),a(b),a(l),a(x),a(w),a(r),a(v),a(P),a(_)),a(s),U(i,e),U(c,e),U(m),U(d,e)}}}const X='{"title":"Pipeline parallelism","local":"pipeline-parallelism","sections":[{"title":"prepare_pippy","local":"accelerate.prepare_pippy","sections":[],"depth":2}],"depth":1}';function Y(I){return z(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ne extends B{constructor(s){super(),V(this,s,Y,Q,R,{})}}export{ne as component};
