import{s as Ct,o as jt,n as It}from"../chunks/scheduler.8c3d61f6.js";import{S as Ut,i as Zt,g as r,s as o,r as m,A as Vt,h as d,f as s,c as a,j as M,u as f,x as v,k as I,y as i,a as n,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 Jt}from"../chunks/CodeBlock.00a903b3.js";import{E as Mt}from"../chunks/ExampleCodeBlock.db12be95.js";import{H as C,E as Lt}from"../chunks/EditOnGithub.1e64e623.js";function Nt(ie){let p,J="Example:",$,_,b;return _=new Jt({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(){p=r("p"),p.textContent=J,$=o(),m(_.$$.fragment)},l(l){p=d(l,"P",{"data-svelte-h":!0}),v(p)!=="svelte-11lpom8"&&(p.textContent=J),$=a(l),f(_.$$.fragment,l)},m(l,w){n(l,p,w),n(l,$,w),u(_,l,w),b=!0},p:It,i(l){b||(c(_.$$.fragment,l),b=!0)},o(l){g(_.$$.fragment,l),b=!1},d(l){l&&(s(p),s($)),h(_,l)}}}function Dt(ie){let p,J="Example:",$,_,b;return _=new Jt({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(){p=r("p"),p.textContent=J,$=o(),m(_.$$.fragment)},l(l){p=d(l,"P",{"data-svelte-h":!0}),v(p)!=="svelte-11lpom8"&&(p.textContent=J),$=a(l),f(_.$$.fragment,l)},m(l,w){n(l,p,w),n(l,$,w),u(_,l,w),b=!0},p:It,i(l){b||(c(_.$$.fragment,l),b=!0)},o(l){g(_.$$.fragment,l),b=!1},d(l){l&&(s(p),s($)),h(_,l)}}}function Pt(ie){let p,J,$,_,b,l,w,pt="Utility and helper functions for working with 🤗 Diffusers.",ke,E,xe,j,q,Se,re,mt="Convert a numpy image or a batch of images to a PIL image.",Me,z,Ie,U,F,Ae,de,ft="Convert a torch image to a PIL image.",Je,H,Ce,Z,G,Qe,pe,ut="Loads <code>image</code> to a PIL Image.",je,R,Ue,W,X,Ze,S,Ve,k,A,Ye,me,ct=`quality:
Video output quality. Default is 5. Uses variable bit rate. Highest quality is 10, lowest is 0. Set to None to
prevent variable bitrate flags to FFMPEG so you can manually specify them using output_params instead.
Specifying a fixed bitrate using <code>bitrate</code> disables this parameter.`,Oe,fe,gt=`bitrate:
Set a constant bitrate for the video encoding. Default is None causing <code>quality</code> parameter to be used instead.
Better quality videos with smaller file sizes will result from using the <code>quality</code> variable bitrate parameter
rather than specifiying a fixed bitrate with this parameter.`,Ke,ue,ht=`macro_block_size:
Size constraint for video. Width and height, must be divisible by this number. If not divisible by this number
imageio will tell ffmpeg to scale the image up to the next closest size divisible by this number. Most codecs
are compatible with a macroblock size of 16 (default), some can go smaller (4, 8). To disable this automatic
feature set it to None or 1, however be warned many players can’t decode videos that are odd in size and some
codecs will produce poor results or fail. See <a href="https://en.wikipedia.org/wiki/Macroblock" rel="nofollow">https://en.wikipedia.org/wiki/Macroblock</a>.`,Le,Q,Ne,V,Y,et,ce,_t="Prepares a single grid of images. Useful for visualization purposes.",De,O,Pe,L,K,tt,ge,yt=`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.`,Be,ee,Ee,x,te,st,he,bt=`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.`,ot,D,qe,se,ze,y,oe,at,_e,vt=`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.`,nt,ye,$t="Typically, offloading is done at two levels:",lt,be,wt=`<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>`,it,ve,Tt=`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.`,rt,$e,kt=`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.`,dt,P,Fe,ae,He,Te,Ge;return b=new C({props:{title:"Utilities",local:"utilities",headingTag:"h1"}}),E=new C({props:{title:"numpy_to_pil",local:"diffusers.utils.numpy_to_pil",headingTag:"h2"}}),q=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"}}),z=new C({props:{title:"pt_to_pil",local:"diffusers.utils.pt_to_pil",headingTag:"h2"}}),F=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"}}),H=new C({props:{title:"load_image",local:"diffusers.utils.load_image",headingTag:"h2"}}),G=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>
`}}),R=new C({props:{title:"export_to_gif",local:"diffusers.utils.export_to_gif",headingTag:"h2"}}),X=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"}}),S=new C({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"},{name:"quality",val:": float = 5.0"},{name:"bitrate",val:": typing.Optional[int] = None"},{name:"macro_block_size",val:": typing.Optional[int] = 16"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/export_utils.py#L141"}}),Q=new C({props:{title:"make_image_grid",local:"diffusers.utils.make_image_grid",headingTag:"h2"}}),Y=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"}}),O=new C({props:{title:"randn_tensor",local:"diffusers.utils.torch_utils.randn_tensor",headingTag:"h2"}}),K=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"}}),ee=new C({props:{title:"apply_layerwise_casting",local:"diffusers.hooks.apply_layerwise_casting",headingTag:"h2"}}),te=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 Mt({props:{anchor:"diffusers.hooks.apply_layerwise_casting.example",$$slots:{default:[Nt]},$$scope:{ctx:ie}}}),se=new C({props:{title:"apply_group_offloading",local:"diffusers.hooks.apply_group_offloading",headingTag:"h2"}}),oe=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"},{name:"low_cpu_mem_usage",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"},{anchor:"diffusers.hooks.apply_group_offloading.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If True, the CPU memory usage is minimized by pinning tensors on-the-fly instead of pre-pinning them. This
option only matters when using streamed CPU offloading (i.e. <code>use_stream=True</code>). This can be useful when
the CPU memory is a bottleneck but may counteract the benefits of using streams.`,name:"low_cpu_mem_usage"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/hooks/group_offloading.py#L326"}}),P=new Mt({props:{anchor:"diffusers.hooks.apply_group_offloading.example",$$slots:{default:[Dt]},$$scope:{ctx:ie}}}),ae=new Lt({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/utilities.md"}}),{c(){p=r("meta"),J=o(),$=r("p"),_=o(),m(b.$$.fragment),l=o(),w=r("p"),w.textContent=pt,ke=o(),m(E.$$.fragment),xe=o(),j=r("div"),m(q.$$.fragment),Se=o(),re=r("p"),re.textContent=mt,Me=o(),m(z.$$.fragment),Ie=o(),U=r("div"),m(F.$$.fragment),Ae=o(),de=r("p"),de.textContent=ft,Je=o(),m(H.$$.fragment),Ce=o(),Z=r("div"),m(G.$$.fragment),Qe=o(),pe=r("p"),pe.innerHTML=ut,je=o(),m(R.$$.fragment),Ue=o(),W=r("div"),m(X.$$.fragment),Ze=o(),m(S.$$.fragment),Ve=o(),k=r("div"),m(A.$$.fragment),Ye=o(),me=r("p"),me.innerHTML=ct,Oe=o(),fe=r("p"),fe.innerHTML=gt,Ke=o(),ue=r("p"),ue.innerHTML=ht,Le=o(),m(Q.$$.fragment),Ne=o(),V=r("div"),m(Y.$$.fragment),et=o(),ce=r("p"),ce.textContent=_t,De=o(),m(O.$$.fragment),Pe=o(),L=r("div"),m(K.$$.fragment),tt=o(),ge=r("p"),ge.innerHTML=yt,Be=o(),m(ee.$$.fragment),Ee=o(),x=r("div"),m(te.$$.fragment),st=o(),he=r("p"),he.textContent=bt,ot=o(),m(D.$$.fragment),qe=o(),m(se.$$.fragment),ze=o(),y=r("div"),m(oe.$$.fragment),at=o(),_e=r("p"),_e.textContent=vt,nt=o(),ye=r("p"),ye.textContent=$t,lt=o(),be=r("ul"),be.innerHTML=wt,it=o(),ve=r("p"),ve.innerHTML=Tt,rt=o(),$e=r("p"),$e.textContent=kt,dt=o(),m(P.$$.fragment),Fe=o(),m(ae.$$.fragment),He=o(),Te=r("p"),this.h()},l(e){const t=Vt("svelte-u9bgzb",document.head);p=d(t,"META",{name:!0,content:!0}),t.forEach(s),J=a(e),$=d(e,"P",{}),M($).forEach(s),_=a(e),f(b.$$.fragment,e),l=a(e),w=d(e,"P",{"data-svelte-h":!0}),v(w)!=="svelte-sj662i"&&(w.textContent=pt),ke=a(e),f(E.$$.fragment,e),xe=a(e),j=d(e,"DIV",{class:!0});var ne=M(j);f(q.$$.fragment,ne),Se=a(ne),re=d(ne,"P",{"data-svelte-h":!0}),v(re)!=="svelte-49eriv"&&(re.textContent=mt),ne.forEach(s),Me=a(e),f(z.$$.fragment,e),Ie=a(e),U=d(e,"DIV",{class:!0});var le=M(U);f(F.$$.fragment,le),Ae=a(le),de=d(le,"P",{"data-svelte-h":!0}),v(de)!=="svelte-haxfgr"&&(de.textContent=ft),le.forEach(s),Je=a(e),f(H.$$.fragment,e),Ce=a(e),Z=d(e,"DIV",{class:!0});var Re=M(Z);f(G.$$.fragment,Re),Qe=a(Re),pe=d(Re,"P",{"data-svelte-h":!0}),v(pe)!=="svelte-suegrh"&&(pe.innerHTML=ut),Re.forEach(s),je=a(e),f(R.$$.fragment,e),Ue=a(e),W=d(e,"DIV",{class:!0});var xt=M(W);f(X.$$.fragment,xt),xt.forEach(s),Ze=a(e),f(S.$$.fragment,e),Ve=a(e),k=d(e,"DIV",{class:!0});var B=M(k);f(A.$$.fragment,B),Ye=a(B),me=d(B,"P",{"data-svelte-h":!0}),v(me)!=="svelte-1gg2c2d"&&(me.innerHTML=ct),Oe=a(B),fe=d(B,"P",{"data-svelte-h":!0}),v(fe)!=="svelte-mvwzfl"&&(fe.innerHTML=gt),Ke=a(B),ue=d(B,"P",{"data-svelte-h":!0}),v(ue)!=="svelte-15zmktc"&&(ue.innerHTML=ht),B.forEach(s),Le=a(e),f(Q.$$.fragment,e),Ne=a(e),V=d(e,"DIV",{class:!0});var We=M(V);f(Y.$$.fragment,We),et=a(We),ce=d(We,"P",{"data-svelte-h":!0}),v(ce)!=="svelte-rk2372"&&(ce.textContent=_t),We.forEach(s),De=a(e),f(O.$$.fragment,e),Pe=a(e),L=d(e,"DIV",{class:!0});var Xe=M(L);f(K.$$.fragment,Xe),tt=a(Xe),ge=d(Xe,"P",{"data-svelte-h":!0}),v(ge)!=="svelte-11ct46x"&&(ge.innerHTML=yt),Xe.forEach(s),Be=a(e),f(ee.$$.fragment,e),Ee=a(e),x=d(e,"DIV",{class:!0});var we=M(x);f(te.$$.fragment,we),st=a(we),he=d(we,"P",{"data-svelte-h":!0}),v(he)!=="svelte-owzrds"&&(he.textContent=bt),ot=a(we),f(D.$$.fragment,we),we.forEach(s),qe=a(e),f(se.$$.fragment,e),ze=a(e),y=d(e,"DIV",{class:!0});var T=M(y);f(oe.$$.fragment,T),at=a(T),_e=d(T,"P",{"data-svelte-h":!0}),v(_e)!=="svelte-7b2e3l"&&(_e.textContent=vt),nt=a(T),ye=d(T,"P",{"data-svelte-h":!0}),v(ye)!=="svelte-1b92jfk"&&(ye.textContent=$t),lt=a(T),be=d(T,"UL",{"data-svelte-h":!0}),v(be)!=="svelte-k3tp1z"&&(be.innerHTML=wt),it=a(T),ve=d(T,"P",{"data-svelte-h":!0}),v(ve)!=="svelte-18cbdz5"&&(ve.innerHTML=Tt),rt=a(T),$e=d(T,"P",{"data-svelte-h":!0}),v($e)!=="svelte-17duuep"&&($e.textContent=kt),dt=a(T),f(P.$$.fragment,T),T.forEach(s),Fe=a(e),f(ae.$$.fragment,e),He=a(e),Te=d(e,"P",{}),M(Te).forEach(s),this.h()},h(){I(p,"name","hf:doc:metadata"),I(p,"content",Bt),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(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(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(k,"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(L,"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){i(document.head,p),n(e,J,t),n(e,$,t),n(e,_,t),u(b,e,t),n(e,l,t),n(e,w,t),n(e,ke,t),u(E,e,t),n(e,xe,t),n(e,j,t),u(q,j,null),i(j,Se),i(j,re),n(e,Me,t),u(z,e,t),n(e,Ie,t),n(e,U,t),u(F,U,null),i(U,Ae),i(U,de),n(e,Je,t),u(H,e,t),n(e,Ce,t),n(e,Z,t),u(G,Z,null),i(Z,Qe),i(Z,pe),n(e,je,t),u(R,e,t),n(e,Ue,t),n(e,W,t),u(X,W,null),n(e,Ze,t),u(S,e,t),n(e,Ve,t),n(e,k,t),u(A,k,null),i(k,Ye),i(k,me),i(k,Oe),i(k,fe),i(k,Ke),i(k,ue),n(e,Le,t),u(Q,e,t),n(e,Ne,t),n(e,V,t),u(Y,V,null),i(V,et),i(V,ce),n(e,De,t),u(O,e,t),n(e,Pe,t),n(e,L,t),u(K,L,null),i(L,tt),i(L,ge),n(e,Be,t),u(ee,e,t),n(e,Ee,t),n(e,x,t),u(te,x,null),i(x,st),i(x,he),i(x,ot),u(D,x,null),n(e,qe,t),u(se,e,t),n(e,ze,t),n(e,y,t),u(oe,y,null),i(y,at),i(y,_e),i(y,nt),i(y,ye),i(y,lt),i(y,be),i(y,it),i(y,ve),i(y,rt),i(y,$e),i(y,dt),u(P,y,null),n(e,Fe,t),u(ae,e,t),n(e,He,t),n(e,Te,t),Ge=!0},p(e,[t]){const ne={};t&2&&(ne.$$scope={dirty:t,ctx:e}),D.$set(ne);const le={};t&2&&(le.$$scope={dirty:t,ctx:e}),P.$set(le)},i(e){Ge||(c(b.$$.fragment,e),c(E.$$.fragment,e),c(q.$$.fragment,e),c(z.$$.fragment,e),c(F.$$.fragment,e),c(H.$$.fragment,e),c(G.$$.fragment,e),c(R.$$.fragment,e),c(X.$$.fragment,e),c(S.$$.fragment,e),c(A.$$.fragment,e),c(Q.$$.fragment,e),c(Y.$$.fragment,e),c(O.$$.fragment,e),c(K.$$.fragment,e),c(ee.$$.fragment,e),c(te.$$.fragment,e),c(D.$$.fragment,e),c(se.$$.fragment,e),c(oe.$$.fragment,e),c(P.$$.fragment,e),c(ae.$$.fragment,e),Ge=!0)},o(e){g(b.$$.fragment,e),g(E.$$.fragment,e),g(q.$$.fragment,e),g(z.$$.fragment,e),g(F.$$.fragment,e),g(H.$$.fragment,e),g(G.$$.fragment,e),g(R.$$.fragment,e),g(X.$$.fragment,e),g(S.$$.fragment,e),g(A.$$.fragment,e),g(Q.$$.fragment,e),g(Y.$$.fragment,e),g(O.$$.fragment,e),g(K.$$.fragment,e),g(ee.$$.fragment,e),g(te.$$.fragment,e),g(D.$$.fragment,e),g(se.$$.fragment,e),g(oe.$$.fragment,e),g(P.$$.fragment,e),g(ae.$$.fragment,e),Ge=!1},d(e){e&&(s(J),s($),s(_),s(l),s(w),s(ke),s(xe),s(j),s(Me),s(Ie),s(U),s(Je),s(Ce),s(Z),s(je),s(Ue),s(W),s(Ze),s(Ve),s(k),s(Le),s(Ne),s(V),s(De),s(Pe),s(L),s(Be),s(Ee),s(x),s(qe),s(ze),s(y),s(Fe),s(He),s(Te)),s(p),h(b,e),h(E,e),h(q),h(z,e),h(F),h(H,e),h(G),h(R,e),h(X),h(S,e),h(A),h(Q,e),h(Y),h(O,e),h(K),h(ee,e),h(te),h(D),h(se,e),h(oe),h(P),h(ae,e)}}}const Bt='{"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 Et(ie){return jt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Wt extends Ut{constructor(p){super(),Zt(this,p,Et,Pt,Ct,{})}}export{Wt as component};
