import{s as $t,o as vt,n as yt}from"../chunks/scheduler.8c3d61f6.js";import{S as wt,i as Tt,g as r,s as a,r as f,A as xt,h as i,f as s,c as n,j as k,u as m,x as T,k as I,y as p,a as o,v as u,d as c,t as g,w as h}from"../chunks/index.da70eac4.js";import{D as N}from"../chunks/Docstring.6b390b9a.js";import{C as bt}from"../chunks/CodeBlock.00a903b3.js";import{E as _t}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as J,E as kt}from"../chunks/EditOnGithub.1e64e623.js";function It(le){let d,M="Example:",$,_,b;return _=new bt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQ29nVmlkZW9YVHJhbnNmb3JtZXIzRE1vZGVsJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBDb2dWaWRlb1hUcmFuc2Zvcm1lcjNETW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2JTBBKSUwQSUwQWFwcGx5X2xheWVyd2lzZV9jYXN0aW5nKCUwQSUyMCUyMCUyMCUyMHRyYW5zZm9ybWVyJTJDJTBBJTIwJTIwJTIwJTIwc3RvcmFnZV9kdHlwZSUzRHRvcmNoLmZsb2F0OF9lNG0zZm4lMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjBza2lwX21vZHVsZXNfcGF0dGVybiUzRCU1QiUyMnBhdGNoX2VtYmVkJTIyJTJDJTIwJTIybm9ybSUyMiUyQyUyMCUyMnByb2pfb3V0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwbm9uX2Jsb2NraW5nJTNEVHJ1ZSUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> CogVideoXTransformer3DModel

<span class="hljs-meta">&gt;&gt;&gt; </span>transformer = CogVideoXTransformer3DModel.from_pretrained(
<span class="hljs-meta">... </span>    model_id, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>apply_layerwise_casting(
<span class="hljs-meta">... </span>    transformer,
<span class="hljs-meta">... </span>    storage_dtype=torch.float8_e4m3fn,
<span class="hljs-meta">... </span>    compute_dtype=torch.bfloat16,
<span class="hljs-meta">... </span>    skip_modules_pattern=[<span class="hljs-string">&quot;patch_embed&quot;</span>, <span class="hljs-string">&quot;norm&quot;</span>, <span class="hljs-string">&quot;proj_out&quot;</span>],
<span class="hljs-meta">... </span>    non_blocking=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),{c(){d=r("p"),d.textContent=M,$=a(),f(_.$$.fragment)},l(l){d=i(l,"P",{"data-svelte-h":!0}),T(d)!=="svelte-11lpom8"&&(d.textContent=M),$=n(l),m(_.$$.fragment,l)},m(l,v){o(l,d,v),o(l,$,v),u(_,l,v),b=!0},p:yt,i(l){b||(c(_.$$.fragment,l),b=!0)},o(l){g(_.$$.fragment,l),b=!1},d(l){l&&(s(d),s($)),h(_,l)}}}function Mt(le){let d,M="Example:",$,_,b;return _=new bt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvZ1ZpZGVvWFRyYW5zZm9ybWVyM0RNb2RlbCUwQWZyb20lMjBkaWZmdXNlcnMuaG9va3MlMjBpbXBvcnQlMjBhcHBseV9ncm91cF9vZmZsb2FkaW5nJTBBJTBBdHJhbnNmb3JtZXIlMjAlM0QlMjBDb2dWaWRlb1hUcmFuc2Zvcm1lcjNETW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMlRIVURNJTJGQ29nVmlkZW9YLTViJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2JTBBKSUwQSUwQWFwcGx5X2dyb3VwX29mZmxvYWRpbmcoJTBBJTIwJTIwJTIwJTIwdHJhbnNmb3JtZXIlMkMlMEElMjAlMjAlMjAlMjBvbmxvYWRfZGV2aWNlJTNEdG9yY2guZGV2aWNlKCUyMmN1ZGElMjIpJTJDJTBBJTIwJTIwJTIwJTIwb2ZmbG9hZF9kZXZpY2UlM0R0b3JjaC5kZXZpY2UoJTIyY3B1JTIyKSUyQyUwQSUyMCUyMCUyMCUyMG9mZmxvYWRfdHlwZSUzRCUyMmJsb2NrX2xldmVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2Jsb2Nrc19wZXJfZ3JvdXAlM0QyJTJDJTBBJTIwJTIwJTIwJTIwdXNlX3N0cmVhbSUzRFRydWUlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> CogVideoXTransformer3DModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.hooks <span class="hljs-keyword">import</span> apply_group_offloading

<span class="hljs-meta">&gt;&gt;&gt; </span>transformer = CogVideoXTransformer3DModel.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;THUDM/CogVideoX-5b&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>apply_group_offloading(
<span class="hljs-meta">... </span>    transformer,
<span class="hljs-meta">... </span>    onload_device=torch.device(<span class="hljs-string">&quot;cuda&quot;</span>),
<span class="hljs-meta">... </span>    offload_device=torch.device(<span class="hljs-string">&quot;cpu&quot;</span>),
<span class="hljs-meta">... </span>    offload_type=<span class="hljs-string">&quot;block_level&quot;</span>,
<span class="hljs-meta">... </span>    num_blocks_per_group=<span class="hljs-number">2</span>,
<span class="hljs-meta">... </span>    use_stream=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),{c(){d=r("p"),d.textContent=M,$=a(),f(_.$$.fragment)},l(l){d=i(l,"P",{"data-svelte-h":!0}),T(d)!=="svelte-11lpom8"&&(d.textContent=M),$=n(l),m(_.$$.fragment,l)},m(l,v){o(l,d,v),o(l,$,v),u(_,l,v),b=!0},p:yt,i(l){b||(c(_.$$.fragment,l),b=!0)},o(l){g(_.$$.fragment,l),b=!1},d(l){l&&(s(d),s($)),h(_,l)}}}function Jt(le){let d,M,$,_,b,l,v,ot="Utility and helper functions for working with 🤗 Diffusers.",$e,B,ve,C,E,We,re,at="Convert a numpy image or a batch of images to a PIL image.",we,P,Te,j,q,Fe,ie,nt="Convert a torch image to a PIL image.",xe,R,ke,U,X,He,de,lt="Loads <code>image</code> to a PIL Image.",Ie,G,Me,W,F,Je,H,Ce,z,A,je,S,Ue,Z,Q,ze,pe,rt="Prepares a single grid of images. Useful for visualization purposes.",Ze,Y,Ve,V,O,Ae,fe,it=`A helper function to create random tensors on the desired <code>device</code> with the desired <code>dtype</code>. When
passing a list of generators, you can seed each batch size individually. If CPU generators are passed, the tensor
is always created on the CPU.`,Ne,K,De,x,ee,Se,me,dt=`Applies layerwise casting to a given module. The module expected here is a Diffusers ModelMixin but it can be any
nn.Module using diffusers layers or pytorch primitives.`,Qe,D,Le,te,Be,y,se,Ye,ue,pt=`Applies group offloading to the internal layers of a torch.nn.Module. To understand what group offloading is, and
where it is beneficial, we need to first provide some context on how other supported offloading methods work.`,Oe,ce,ft="Typically, offloading is done at two levels:",Ke,ge,mt=`<li>Module-level: In Diffusers, this can be enabled using the <code>ModelMixin::enable_model_cpu_offload()</code> method. It
works by offloading each component of a pipeline to the CPU for storage, and onloading to the accelerator device
when needed for computation. This method is more memory-efficient than keeping all components on the accelerator,
but the memory requirements are still quite high. For this method to work, one needs memory equivalent to size of
the model in runtime dtype + size of largest intermediate activation tensors to be able to complete the forward
pass.</li> <li>Leaf-level: In Diffusers, this can be enabled using the <code>ModelMixin::enable_sequential_cpu_offload()</code> method. It
works by offloading the lowest leaf-level parameters of the computation graph to the CPU for storage, and
onloading only the leafs to the accelerator device for computation. This uses the lowest amount of accelerator
memory, but can be slower due to the excessive number of device synchronizations.</li>`,et,he,ut=`Group offloading is a middle ground between the two methods. It works by offloading groups of internal layers,
(either <code>torch.nn.ModuleList</code> or <code>torch.nn.Sequential</code>). This method uses lower memory than module-level
offloading. It is also faster than leaf-level/sequential offloading, as the number of device synchronizations is
reduced.`,tt,_e,ct=`Another supported feature (for CUDA devices with support for asynchronous data transfer streams) is the ability to
overlap data transfer and computation to reduce the overall execution time compared to sequential offloading. This
is enabled using layer prefetching with streams, i.e., the layer that is to be executed next starts onloading to
the accelerator device while the current layer is being executed - this increases the memory requirements slightly.
Note that this implementation also supports leaf-level offloading but can be made much faster when using streams.`,st,L,Ee,oe,Pe,be,qe;return b=new J({props:{title:"Utilities",local:"utilities",headingTag:"h1"}}),B=new J({props:{title:"numpy_to_pil",local:"diffusers.utils.numpy_to_pil",headingTag:"h2"}}),E=new N({props:{name:"diffusers.utils.numpy_to_pil",anchor:"diffusers.utils.numpy_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/pil_utils.py#L37"}}),P=new J({props:{title:"pt_to_pil",local:"diffusers.utils.pt_to_pil",headingTag:"h2"}}),q=new N({props:{name:"diffusers.utils.pt_to_pil",anchor:"diffusers.utils.pt_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/pil_utils.py#L27"}}),R=new J({props:{title:"load_image",local:"diffusers.utils.load_image",headingTag:"h2"}}),X=new N({props:{name:"diffusers.utils.load_image",anchor:"diffusers.utils.load_image",parameters:[{name:"image",val:": typing.Union[str, PIL.Image.Image]"},{name:"convert_method",val:": typing.Optional[typing.Callable[[PIL.Image.Image], PIL.Image.Image]] = None"}],parametersDescription:[{anchor:"diffusers.utils.load_image.image",description:`<strong>image</strong> (<code>str</code> or <code>PIL.Image.Image</code>) &#x2014;
The image to convert to the PIL Image format.`,name:"image"},{anchor:"diffusers.utils.load_image.convert_method",description:`<strong>convert_method</strong> (Callable[[PIL.Image.Image], PIL.Image.Image], <em>optional</em>) &#x2014;
A conversion method to apply to the image after loading it. When set to <code>None</code> the image will be converted
&#x201C;RGB&#x201D;.`,name:"convert_method"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/loading_utils.py#L13",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A PIL Image.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>PIL.Image.Image</code></p>
`}}),G=new J({props:{title:"export_to_gif",local:"diffusers.utils.export_to_gif",headingTag:"h2"}}),F=new N({props:{name:"diffusers.utils.export_to_gif",anchor:"diffusers.utils.export_to_gif",parameters:[{name:"image",val:": typing.List[PIL.Image.Image]"},{name:"output_gif_path",val:": str = None"},{name:"fps",val:": int = 10"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/export_utils.py#L28"}}),H=new J({props:{title:"export_to_video",local:"diffusers.utils.export_to_video",headingTag:"h2"}}),A=new N({props:{name:"diffusers.utils.export_to_video",anchor:"diffusers.utils.export_to_video",parameters:[{name:"video_frames",val:": typing.Union[typing.List[numpy.ndarray], typing.List[PIL.Image.Image]]"},{name:"output_video_path",val:": str = None"},{name:"fps",val:": int = 10"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/export_utils.py#L141"}}),S=new J({props:{title:"make_image_grid",local:"diffusers.utils.make_image_grid",headingTag:"h2"}}),Q=new N({props:{name:"diffusers.utils.make_image_grid",anchor:"diffusers.utils.make_image_grid",parameters:[{name:"images",val:": typing.List[PIL.Image.Image]"},{name:"rows",val:": int"},{name:"cols",val:": int"},{name:"resize",val:": int = None"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/pil_utils.py#L53"}}),Y=new J({props:{title:"randn_tensor",local:"diffusers.utils.torch_utils.randn_tensor",headingTag:"h2"}}),O=new N({props:{name:"diffusers.utils.torch_utils.randn_tensor",anchor:"diffusers.utils.torch_utils.randn_tensor",parameters:[{name:"shape",val:": typing.Union[typing.Tuple, typing.List]"},{name:"generator",val:": typing.Union[typing.List[ForwardRef('torch.Generator')], ForwardRef('torch.Generator'), NoneType] = None"},{name:"device",val:": typing.Optional[ForwardRef('torch.device')] = None"},{name:"dtype",val:": typing.Optional[ForwardRef('torch.dtype')] = None"},{name:"layout",val:": typing.Optional[ForwardRef('torch.layout')] = None"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/torch_utils.py#L38"}}),K=new J({props:{title:"apply_layerwise_casting",local:"diffusers.hooks.apply_layerwise_casting",headingTag:"h2"}}),ee=new N({props:{name:"diffusers.hooks.apply_layerwise_casting",anchor:"diffusers.hooks.apply_layerwise_casting",parameters:[{name:"module",val:": Module"},{name:"storage_dtype",val:": dtype"},{name:"compute_dtype",val:": dtype"},{name:"skip_modules_pattern",val:": typing.Union[str, typing.Tuple[str, ...]] = 'auto'"},{name:"skip_modules_classes",val:": typing.Optional[typing.Tuple[typing.Type[torch.nn.modules.module.Module], ...]] = None"},{name:"non_blocking",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.hooks.apply_layerwise_casting.module",description:`<strong>module</strong> (<code>torch.nn.Module</code>) &#x2014;
The module whose leaf modules will be cast to a high precision dtype for computation, and to a low
precision dtype for storage.`,name:"module"},{anchor:"diffusers.hooks.apply_layerwise_casting.storage_dtype",description:`<strong>storage_dtype</strong> (<code>torch.dtype</code>) &#x2014;
The dtype to cast the module to before/after the forward pass for storage.`,name:"storage_dtype"},{anchor:"diffusers.hooks.apply_layerwise_casting.compute_dtype",description:`<strong>compute_dtype</strong> (<code>torch.dtype</code>) &#x2014;
The dtype to cast the module to during the forward pass for computation.`,name:"compute_dtype"},{anchor:"diffusers.hooks.apply_layerwise_casting.skip_modules_pattern",description:`<strong>skip_modules_pattern</strong> (<code>Tuple[str, ...]</code>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
A list of patterns to match the names of the modules to skip during the layerwise casting process. If set
to <code>&quot;auto&quot;</code>, the default patterns are used. If set to <code>None</code>, no modules are skipped. If set to <code>None</code>
alongside <code>skip_modules_classes</code> being <code>None</code>, the layerwise casting is applied directly to the module
instead of its internal submodules.`,name:"skip_modules_pattern"},{anchor:"diffusers.hooks.apply_layerwise_casting.skip_modules_classes",description:`<strong>skip_modules_classes</strong> (<code>Tuple[Type[torch.nn.Module], ...]</code>, defaults to <code>None</code>) &#x2014;
A list of module classes to skip during the layerwise casting process.`,name:"skip_modules_classes"},{anchor:"diffusers.hooks.apply_layerwise_casting.non_blocking",description:`<strong>non_blocking</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the weight casting operations are non-blocking.`,name:"non_blocking"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/hooks/layerwise_casting.py#L106"}}),D=new _t({props:{anchor:"diffusers.hooks.apply_layerwise_casting.example",$$slots:{default:[It]},$$scope:{ctx:le}}}),te=new J({props:{title:"apply_group_offloading",local:"diffusers.hooks.apply_group_offloading",headingTag:"h2"}}),se=new N({props:{name:"diffusers.hooks.apply_group_offloading",anchor:"diffusers.hooks.apply_group_offloading",parameters:[{name:"module",val:": Module"},{name:"onload_device",val:": device"},{name:"offload_device",val:": device = device(type='cpu')"},{name:"offload_type",val:": str = 'block_level'"},{name:"num_blocks_per_group",val:": typing.Optional[int] = None"},{name:"non_blocking",val:": bool = False"},{name:"use_stream",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.hooks.apply_group_offloading.module",description:`<strong>module</strong> (<code>torch.nn.Module</code>) &#x2014;
The module to which group offloading is applied.`,name:"module"},{anchor:"diffusers.hooks.apply_group_offloading.onload_device",description:`<strong>onload_device</strong> (<code>torch.device</code>) &#x2014;
The device to which the group of modules are onloaded.`,name:"onload_device"},{anchor:"diffusers.hooks.apply_group_offloading.offload_device",description:`<strong>offload_device</strong> (<code>torch.device</code>, defaults to <code>torch.device(&quot;cpu&quot;)</code>) &#x2014;
The device to which the group of modules are offloaded. This should typically be the CPU. Default is CPU.`,name:"offload_device"},{anchor:"diffusers.hooks.apply_group_offloading.offload_type",description:`<strong>offload_type</strong> (<code>str</code>, defaults to &#x201C;block_level&#x201D;) &#x2014;
The type of offloading to be applied. Can be one of &#x201C;block_level&#x201D; or &#x201C;leaf_level&#x201D;. Default is
&#x201C;block_level&#x201D;.`,name:"offload_type"},{anchor:"diffusers.hooks.apply_group_offloading.num_blocks_per_group",description:`<strong>num_blocks_per_group</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of blocks per group when using offload_type=&#x201C;block_level&#x201D;. This is required when using
offload_type=&#x201C;block_level&#x201D;.`,name:"num_blocks_per_group"},{anchor:"diffusers.hooks.apply_group_offloading.non_blocking",description:`<strong>non_blocking</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If True, offloading and onloading is done with non-blocking data transfer.`,name:"non_blocking"},{anchor:"diffusers.hooks.apply_group_offloading.use_stream",description:`<strong>use_stream</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If True, offloading and onloading is done asynchronously using a CUDA stream. This can be useful for
overlapping computation and data transfer.`,name:"use_stream"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/hooks/group_offloading.py#L263"}}),L=new _t({props:{anchor:"diffusers.hooks.apply_group_offloading.example",$$slots:{default:[Mt]},$$scope:{ctx:le}}}),oe=new kt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/utilities.md"}}),{c(){d=r("meta"),M=a(),$=r("p"),_=a(),f(b.$$.fragment),l=a(),v=r("p"),v.textContent=ot,$e=a(),f(B.$$.fragment),ve=a(),C=r("div"),f(E.$$.fragment),We=a(),re=r("p"),re.textContent=at,we=a(),f(P.$$.fragment),Te=a(),j=r("div"),f(q.$$.fragment),Fe=a(),ie=r("p"),ie.textContent=nt,xe=a(),f(R.$$.fragment),ke=a(),U=r("div"),f(X.$$.fragment),He=a(),de=r("p"),de.innerHTML=lt,Ie=a(),f(G.$$.fragment),Me=a(),W=r("div"),f(F.$$.fragment),Je=a(),f(H.$$.fragment),Ce=a(),z=r("div"),f(A.$$.fragment),je=a(),f(S.$$.fragment),Ue=a(),Z=r("div"),f(Q.$$.fragment),ze=a(),pe=r("p"),pe.textContent=rt,Ze=a(),f(Y.$$.fragment),Ve=a(),V=r("div"),f(O.$$.fragment),Ae=a(),fe=r("p"),fe.innerHTML=it,Ne=a(),f(K.$$.fragment),De=a(),x=r("div"),f(ee.$$.fragment),Se=a(),me=r("p"),me.textContent=dt,Qe=a(),f(D.$$.fragment),Le=a(),f(te.$$.fragment),Be=a(),y=r("div"),f(se.$$.fragment),Ye=a(),ue=r("p"),ue.textContent=pt,Oe=a(),ce=r("p"),ce.textContent=ft,Ke=a(),ge=r("ul"),ge.innerHTML=mt,et=a(),he=r("p"),he.innerHTML=ut,tt=a(),_e=r("p"),_e.textContent=ct,st=a(),f(L.$$.fragment),Ee=a(),f(oe.$$.fragment),Pe=a(),be=r("p"),this.h()},l(e){const t=xt("svelte-u9bgzb",document.head);d=i(t,"META",{name:!0,content:!0}),t.forEach(s),M=n(e),$=i(e,"P",{}),k($).forEach(s),_=n(e),m(b.$$.fragment,e),l=n(e),v=i(e,"P",{"data-svelte-h":!0}),T(v)!=="svelte-sj662i"&&(v.textContent=ot),$e=n(e),m(B.$$.fragment,e),ve=n(e),C=i(e,"DIV",{class:!0});var ae=k(C);m(E.$$.fragment,ae),We=n(ae),re=i(ae,"P",{"data-svelte-h":!0}),T(re)!=="svelte-49eriv"&&(re.textContent=at),ae.forEach(s),we=n(e),m(P.$$.fragment,e),Te=n(e),j=i(e,"DIV",{class:!0});var ne=k(j);m(q.$$.fragment,ne),Fe=n(ne),ie=i(ne,"P",{"data-svelte-h":!0}),T(ie)!=="svelte-haxfgr"&&(ie.textContent=nt),ne.forEach(s),xe=n(e),m(R.$$.fragment,e),ke=n(e),U=i(e,"DIV",{class:!0});var Re=k(U);m(X.$$.fragment,Re),He=n(Re),de=i(Re,"P",{"data-svelte-h":!0}),T(de)!=="svelte-suegrh"&&(de.innerHTML=lt),Re.forEach(s),Ie=n(e),m(G.$$.fragment,e),Me=n(e),W=i(e,"DIV",{class:!0});var gt=k(W);m(F.$$.fragment,gt),gt.forEach(s),Je=n(e),m(H.$$.fragment,e),Ce=n(e),z=i(e,"DIV",{class:!0});var ht=k(z);m(A.$$.fragment,ht),ht.forEach(s),je=n(e),m(S.$$.fragment,e),Ue=n(e),Z=i(e,"DIV",{class:!0});var Xe=k(Z);m(Q.$$.fragment,Xe),ze=n(Xe),pe=i(Xe,"P",{"data-svelte-h":!0}),T(pe)!=="svelte-rk2372"&&(pe.textContent=rt),Xe.forEach(s),Ze=n(e),m(Y.$$.fragment,e),Ve=n(e),V=i(e,"DIV",{class:!0});var Ge=k(V);m(O.$$.fragment,Ge),Ae=n(Ge),fe=i(Ge,"P",{"data-svelte-h":!0}),T(fe)!=="svelte-11ct46x"&&(fe.innerHTML=it),Ge.forEach(s),Ne=n(e),m(K.$$.fragment,e),De=n(e),x=i(e,"DIV",{class:!0});var ye=k(x);m(ee.$$.fragment,ye),Se=n(ye),me=i(ye,"P",{"data-svelte-h":!0}),T(me)!=="svelte-owzrds"&&(me.textContent=dt),Qe=n(ye),m(D.$$.fragment,ye),ye.forEach(s),Le=n(e),m(te.$$.fragment,e),Be=n(e),y=i(e,"DIV",{class:!0});var w=k(y);m(se.$$.fragment,w),Ye=n(w),ue=i(w,"P",{"data-svelte-h":!0}),T(ue)!=="svelte-7b2e3l"&&(ue.textContent=pt),Oe=n(w),ce=i(w,"P",{"data-svelte-h":!0}),T(ce)!=="svelte-1b92jfk"&&(ce.textContent=ft),Ke=n(w),ge=i(w,"UL",{"data-svelte-h":!0}),T(ge)!=="svelte-k3tp1z"&&(ge.innerHTML=mt),et=n(w),he=i(w,"P",{"data-svelte-h":!0}),T(he)!=="svelte-18cbdz5"&&(he.innerHTML=ut),tt=n(w),_e=i(w,"P",{"data-svelte-h":!0}),T(_e)!=="svelte-17duuep"&&(_e.textContent=ct),st=n(w),m(L.$$.fragment,w),w.forEach(s),Ee=n(e),m(oe.$$.fragment,e),Pe=n(e),be=i(e,"P",{}),k(be).forEach(s),this.h()},h(){I(d,"name","hf:doc:metadata"),I(d,"content",Ct),I(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(y,"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){p(document.head,d),o(e,M,t),o(e,$,t),o(e,_,t),u(b,e,t),o(e,l,t),o(e,v,t),o(e,$e,t),u(B,e,t),o(e,ve,t),o(e,C,t),u(E,C,null),p(C,We),p(C,re),o(e,we,t),u(P,e,t),o(e,Te,t),o(e,j,t),u(q,j,null),p(j,Fe),p(j,ie),o(e,xe,t),u(R,e,t),o(e,ke,t),o(e,U,t),u(X,U,null),p(U,He),p(U,de),o(e,Ie,t),u(G,e,t),o(e,Me,t),o(e,W,t),u(F,W,null),o(e,Je,t),u(H,e,t),o(e,Ce,t),o(e,z,t),u(A,z,null),o(e,je,t),u(S,e,t),o(e,Ue,t),o(e,Z,t),u(Q,Z,null),p(Z,ze),p(Z,pe),o(e,Ze,t),u(Y,e,t),o(e,Ve,t),o(e,V,t),u(O,V,null),p(V,Ae),p(V,fe),o(e,Ne,t),u(K,e,t),o(e,De,t),o(e,x,t),u(ee,x,null),p(x,Se),p(x,me),p(x,Qe),u(D,x,null),o(e,Le,t),u(te,e,t),o(e,Be,t),o(e,y,t),u(se,y,null),p(y,Ye),p(y,ue),p(y,Oe),p(y,ce),p(y,Ke),p(y,ge),p(y,et),p(y,he),p(y,tt),p(y,_e),p(y,st),u(L,y,null),o(e,Ee,t),u(oe,e,t),o(e,Pe,t),o(e,be,t),qe=!0},p(e,[t]){const ae={};t&2&&(ae.$$scope={dirty:t,ctx:e}),D.$set(ae);const ne={};t&2&&(ne.$$scope={dirty:t,ctx:e}),L.$set(ne)},i(e){qe||(c(b.$$.fragment,e),c(B.$$.fragment,e),c(E.$$.fragment,e),c(P.$$.fragment,e),c(q.$$.fragment,e),c(R.$$.fragment,e),c(X.$$.fragment,e),c(G.$$.fragment,e),c(F.$$.fragment,e),c(H.$$.fragment,e),c(A.$$.fragment,e),c(S.$$.fragment,e),c(Q.$$.fragment,e),c(Y.$$.fragment,e),c(O.$$.fragment,e),c(K.$$.fragment,e),c(ee.$$.fragment,e),c(D.$$.fragment,e),c(te.$$.fragment,e),c(se.$$.fragment,e),c(L.$$.fragment,e),c(oe.$$.fragment,e),qe=!0)},o(e){g(b.$$.fragment,e),g(B.$$.fragment,e),g(E.$$.fragment,e),g(P.$$.fragment,e),g(q.$$.fragment,e),g(R.$$.fragment,e),g(X.$$.fragment,e),g(G.$$.fragment,e),g(F.$$.fragment,e),g(H.$$.fragment,e),g(A.$$.fragment,e),g(S.$$.fragment,e),g(Q.$$.fragment,e),g(Y.$$.fragment,e),g(O.$$.fragment,e),g(K.$$.fragment,e),g(ee.$$.fragment,e),g(D.$$.fragment,e),g(te.$$.fragment,e),g(se.$$.fragment,e),g(L.$$.fragment,e),g(oe.$$.fragment,e),qe=!1},d(e){e&&(s(M),s($),s(_),s(l),s(v),s($e),s(ve),s(C),s(we),s(Te),s(j),s(xe),s(ke),s(U),s(Ie),s(Me),s(W),s(Je),s(Ce),s(z),s(je),s(Ue),s(Z),s(Ze),s(Ve),s(V),s(Ne),s(De),s(x),s(Le),s(Be),s(y),s(Ee),s(Pe),s(be)),s(d),h(b,e),h(B,e),h(E),h(P,e),h(q),h(R,e),h(X),h(G,e),h(F),h(H,e),h(A),h(S,e),h(Q),h(Y,e),h(O),h(K,e),h(ee),h(D),h(te,e),h(se),h(L),h(oe,e)}}}const Ct='{"title":"Utilities","local":"utilities","sections":[{"title":"numpy_to_pil","local":"diffusers.utils.numpy_to_pil","sections":[],"depth":2},{"title":"pt_to_pil","local":"diffusers.utils.pt_to_pil","sections":[],"depth":2},{"title":"load_image","local":"diffusers.utils.load_image","sections":[],"depth":2},{"title":"export_to_gif","local":"diffusers.utils.export_to_gif","sections":[],"depth":2},{"title":"export_to_video","local":"diffusers.utils.export_to_video","sections":[],"depth":2},{"title":"make_image_grid","local":"diffusers.utils.make_image_grid","sections":[],"depth":2},{"title":"randn_tensor","local":"diffusers.utils.torch_utils.randn_tensor","sections":[],"depth":2},{"title":"apply_layerwise_casting","local":"diffusers.hooks.apply_layerwise_casting","sections":[],"depth":2},{"title":"apply_group_offloading","local":"diffusers.hooks.apply_group_offloading","sections":[],"depth":2}],"depth":1}';function jt(le){return vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bt extends wt{constructor(d){super(),Tt(this,d,jt,Jt,$t,{})}}export{Bt as component};
