Buckets:

HuggingFaceDocBuilder's picture
download
raw
5.84 kB
import{s as j,n as B,o as V}from"../chunks/scheduler.b9285784.js";import{S as W,i as J,e as g,s as p,c as $,h as K,a as f,d as a,b as i,f as N,g as b,j as F,k as S,l as D,m as n,n as x,t as w,o as v,p as P}from"../chunks/index.26bc89a1.js";import{C as Q,H as R,E as X}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.bdcdbdb3.js";import{D as Y}from"../chunks/Docstring.06766c68.js";function Z(I){let s,k,_,T,l,L,o,M,c,q='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.',A,m,E,r,d,C,h,z="Wraps <code>model</code> for pipeline parallel inference.",H,u,U,y,G;return l=new Q({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),o=new R({props:{title:"Pipeline parallelism",local:"pipeline-parallelism",headingTag:"h1"}}),m=new R({props:{title:"prepare_pippy",local:"accelerate.prepare_pippy",headingTag:"h2"}}),d=new Y({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/vr_4092/src/accelerate/inference.py#L126"}}),u=new X({props:{source:"https://github.com/huggingface/accelerate/blob/main/docs/source/package_reference/inference.md"}}),{c(){s=g("meta"),k=p(),_=g("p"),T=p(),$(l.$$.fragment),L=p(),$(o.$$.fragment),M=p(),c=g("p"),c.innerHTML=q,A=p(),$(m.$$.fragment),E=p(),r=g("div"),$(d.$$.fragment),C=p(),h=g("p"),h.innerHTML=z,H=p(),$(u.$$.fragment),U=p(),y=g("p"),this.h()},l(e){const t=K("svelte-u9bgzb",document.head);s=f(t,"META",{name:!0,content:!0}),t.forEach(a),k=i(e),_=f(e,"P",{}),N(_).forEach(a),T=i(e),b(l.$$.fragment,e),L=i(e),b(o.$$.fragment,e),M=i(e),c=f(e,"P",{"data-svelte-h":!0}),F(c)!=="svelte-mnc17l"&&(c.innerHTML=q),A=i(e),b(m.$$.fragment,e),E=i(e),r=f(e,"DIV",{class:!0});var O=N(r);b(d.$$.fragment,O),C=i(O),h=f(O,"P",{"data-svelte-h":!0}),F(h)!=="svelte-1pc33ak"&&(h.innerHTML=z),O.forEach(a),H=i(e),b(u.$$.fragment,e),U=i(e),y=f(e,"P",{}),N(y).forEach(a),this.h()},h(){S(s,"name","hf:doc:metadata"),S(s,"content",ee),S(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,k,t),n(e,_,t),n(e,T,t),x(l,e,t),n(e,L,t),x(o,e,t),n(e,M,t),n(e,c,t),n(e,A,t),x(m,e,t),n(e,E,t),n(e,r,t),x(d,r,null),D(r,C),D(r,h),n(e,H,t),x(u,e,t),n(e,U,t),n(e,y,t),G=!0},p:B,i(e){G||(w(l.$$.fragment,e),w(o.$$.fragment,e),w(m.$$.fragment,e),w(d.$$.fragment,e),w(u.$$.fragment,e),G=!0)},o(e){v(l.$$.fragment,e),v(o.$$.fragment,e),v(m.$$.fragment,e),v(d.$$.fragment,e),v(u.$$.fragment,e),G=!1},d(e){e&&(a(k),a(_),a(T),a(L),a(M),a(c),a(A),a(E),a(r),a(H),a(U),a(y)),a(s),P(l,e),P(o,e),P(m,e),P(d),P(u,e)}}}const ee='{"title":"Pipeline parallelism","local":"pipeline-parallelism","sections":[{"title":"prepare_pippy","local":"accelerate.prepare_pippy","sections":[],"depth":2}],"depth":1}';function te(I){return V(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pe extends W{constructor(s){super(),J(this,s,te,Z,j,{})}}export{pe as component};

Xet Storage Details

Size:
5.84 kB
·
Xet hash:
85e3c9565ee82296b3b574734f3c276ad71d235264cadadb938df154456deb7b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.