import{s as oe,n as re,o as se}from"../chunks/scheduler.8c3d61f6.js";import{S as ie,i as fe,g as r,s as a,r as $,A as me,h as s,f as n,c as o,j as T,u as C,x as J,k as q,y,a as l,v as b,d as P,t as N,w}from"../chunks/index.da70eac4.js";import{D as Y}from"../chunks/Docstring.367be9ed.js";import{H as Z,E as de}from"../chunks/getInferenceSnippets.cb466318.js";function pe(ee){let i,O,k,I,p,S,g,te="Parallelism strategies help speed up diffusion transformers by distributing computations across multiple devices, allowing for faster inference/training times.",U,c,j,f,u,K,D,ne="Configuration for applying different parallelisms.",z,_,A,m,h,Q,M,le="Configuration for context parallelism.",V,d,v,X,E,ae="Apply context parallel on a model.",H,x,G,L,R;return p=new Z({props:{title:"Parallelism",local:"parallelism",headingTag:"h1"}}),c=new Z({props:{title:"ParallelConfig",local:"diffusers.ParallelConfig",headingTag:"h2"}}),u=new Y({props:{name:"class diffusers.ParallelConfig",anchor:"diffusers.ParallelConfig",parameters:[{name:"context_parallel_config",val:": typing.Optional[diffusers.models._modeling_parallel.ContextParallelConfig] = None"},{name:"_rank",val:": int = None"},{name:"_world_size",val:": int = None"},{name:"_device",val:": device = None"},{name:"_cp_mesh",val:": DeviceMesh = None"}],parametersDescription:[{anchor:"diffusers.ParallelConfig.context_parallel_config",description:`<strong>context_parallel_config</strong> (<code>ContextParallelConfig</code>, <em>optional</em>) &#x2014;
Configuration for context parallelism.`,name:"context_parallel_config"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/_modeling_parallel.py#L108"}}),_=new Z({props:{title:"ContextParallelConfig",local:"diffusers.ContextParallelConfig",headingTag:"h2"}}),h=new Y({props:{name:"class diffusers.ContextParallelConfig",anchor:"diffusers.ContextParallelConfig",parameters:[{name:"ring_degree",val:": typing.Optional[int] = None"},{name:"ulysses_degree",val:": typing.Optional[int] = None"},{name:"convert_to_fp32",val:": bool = True"},{name:"rotate_method",val:": typing.Literal['allgather', 'alltoall'] = 'allgather'"},{name:"_rank",val:": int = None"},{name:"_world_size",val:": int = None"},{name:"_device",val:": device = None"},{name:"_mesh",val:": DeviceMesh = None"},{name:"_flattened_mesh",val:": DeviceMesh = None"},{name:"_ring_mesh",val:": DeviceMesh = None"},{name:"_ulysses_mesh",val:": DeviceMesh = None"},{name:"_ring_local_rank",val:": int = None"},{name:"_ulysses_local_rank",val:": int = None"}],parametersDescription:[{anchor:"diffusers.ContextParallelConfig.ring_degree",description:`<strong>ring_degree</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1</code>) &#x2014;
Number of devices to use for ring attention within a context parallel region. Must be a divisor of the
total number of devices in the context parallel mesh.`,name:"ring_degree"},{anchor:"diffusers.ContextParallelConfig.ulysses_degree",description:`<strong>ulysses_degree</strong> (<code>int</code>, <em>optional</em>, defaults to <code>1</code>) &#x2014;
Number of devices to use for ulysses attention within a context parallel region. Must be a divisor of the
total number of devices in the context parallel mesh.`,name:"ulysses_degree"},{anchor:"diffusers.ContextParallelConfig.convert_to_fp32",description:`<strong>convert_to_fp32</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to convert output and LSE to float32 for ring attention numerical stability.`,name:"convert_to_fp32"},{anchor:"diffusers.ContextParallelConfig.rotate_method",description:`<strong>rotate_method</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;allgather&quot;</code>) &#x2014;
Method to use for rotating key/value states across devices in ring attention. Currently, only <code>&quot;allgather&quot;</code>
is supported.`,name:"rotate_method"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/_modeling_parallel.py#L41"}}),v=new Y({props:{name:"diffusers.hooks.apply_context_parallel",anchor:"diffusers.hooks.apply_context_parallel",parameters:[{name:"module",val:": Module"},{name:"parallel_config",val:": ContextParallelConfig"},{name:"plan",val:": typing.Dict[str, typing.Dict[str, typing.Union[typing.Dict[typing.Union[str, int], typing.Union[diffusers.models._modeling_parallel.ContextParallelInput, typing.List[diffusers.models._modeling_parallel.ContextParallelInput], typing.Tuple[diffusers.models._modeling_parallel.ContextParallelInput, ...]]], diffusers.models._modeling_parallel.ContextParallelOutput, typing.List[diffusers.models._modeling_parallel.ContextParallelOutput], typing.Tuple[diffusers.models._modeling_parallel.ContextParallelOutput, ...]]]]"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/hooks/context_parallel.py#L75"}}),x=new de({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/parallel.md"}}),{c(){i=r("meta"),O=a(),k=r("p"),I=a(),$(p.$$.fragment),S=a(),g=r("p"),g.textContent=te,U=a(),$(c.$$.fragment),j=a(),f=r("div"),$(u.$$.fragment),K=a(),D=r("p"),D.textContent=ne,z=a(),$(_.$$.fragment),A=a(),m=r("div"),$(h.$$.fragment),Q=a(),M=r("p"),M.textContent=le,V=a(),d=r("div"),$(v.$$.fragment),X=a(),E=r("p"),E.textContent=ae,H=a(),$(x.$$.fragment),G=a(),L=r("p"),this.h()},l(e){const t=me("svelte-u9bgzb",document.head);i=s(t,"META",{name:!0,content:!0}),t.forEach(n),O=o(e),k=s(e,"P",{}),T(k).forEach(n),I=o(e),C(p.$$.fragment,e),S=o(e),g=s(e,"P",{"data-svelte-h":!0}),J(g)!=="svelte-1xm1r3v"&&(g.textContent=te),U=o(e),C(c.$$.fragment,e),j=o(e),f=s(e,"DIV",{class:!0});var W=T(f);C(u.$$.fragment,W),K=o(W),D=s(W,"P",{"data-svelte-h":!0}),J(D)!=="svelte-1xt9qrn"&&(D.textContent=ne),W.forEach(n),z=o(e),C(_.$$.fragment,e),A=o(e),m=s(e,"DIV",{class:!0});var B=T(m);C(h.$$.fragment,B),Q=o(B),M=s(B,"P",{"data-svelte-h":!0}),J(M)!=="svelte-1ng6p0q"&&(M.textContent=le),B.forEach(n),V=o(e),d=s(e,"DIV",{class:!0});var F=T(d);C(v.$$.fragment,F),X=o(F),E=s(F,"P",{"data-svelte-h":!0}),J(E)!=="svelte-jjn757"&&(E.textContent=ae),F.forEach(n),H=o(e),C(x.$$.fragment,e),G=o(e),L=s(e,"P",{}),T(L).forEach(n),this.h()},h(){q(i,"name","hf:doc:metadata"),q(i,"content",ge),q(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(d,"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){y(document.head,i),l(e,O,t),l(e,k,t),l(e,I,t),b(p,e,t),l(e,S,t),l(e,g,t),l(e,U,t),b(c,e,t),l(e,j,t),l(e,f,t),b(u,f,null),y(f,K),y(f,D),l(e,z,t),b(_,e,t),l(e,A,t),l(e,m,t),b(h,m,null),y(m,Q),y(m,M),l(e,V,t),l(e,d,t),b(v,d,null),y(d,X),y(d,E),l(e,H,t),b(x,e,t),l(e,G,t),l(e,L,t),R=!0},p:re,i(e){R||(P(p.$$.fragment,e),P(c.$$.fragment,e),P(u.$$.fragment,e),P(_.$$.fragment,e),P(h.$$.fragment,e),P(v.$$.fragment,e),P(x.$$.fragment,e),R=!0)},o(e){N(p.$$.fragment,e),N(c.$$.fragment,e),N(u.$$.fragment,e),N(_.$$.fragment,e),N(h.$$.fragment,e),N(v.$$.fragment,e),N(x.$$.fragment,e),R=!1},d(e){e&&(n(O),n(k),n(I),n(S),n(g),n(U),n(j),n(f),n(z),n(A),n(m),n(V),n(d),n(H),n(G),n(L)),n(i),w(p,e),w(c,e),w(u),w(_,e),w(h),w(v),w(x,e)}}}const ge='{"title":"Parallelism","local":"parallelism","sections":[{"title":"ParallelConfig","local":"diffusers.ParallelConfig","sections":[],"depth":2},{"title":"ContextParallelConfig","local":"diffusers.ContextParallelConfig","sections":[],"depth":2}],"depth":1}';function ce(ee){return se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends ie{constructor(i){super(),fe(this,i,ce,pe,oe,{})}}export{xe as component};
