import{s as Q,n as Y,o as Z}from"../chunks/scheduler.53228c21.js";import{S as ee,i as oe,e as _,s as r,c as h,h as te,a as y,d as t,b as s,f as z,g as b,j as J,k as A,l as E,m as n,n as q,t as $,o as x,p as v}from"../chunks/index.100fac89.js";import{C as ne}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{D as K}from"../chunks/Docstring.db856a1e.js";import{H as W,E as re}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function se(X){let i,F,T,C,a,L,p,P,l,R,d,u,U,w,G="Hugging Face Hybrid Inference that allow running VAE decode remotely.",S,f,N,c,m,M,I,B="Hugging Face Hybrid Inference that allow running VAE encode remotely.",V,g,j,D,H;return a=new ne({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new W({props:{title:"Hybrid Inference API Reference",local:"hybrid-inference-api-reference",headingTag:"h1"}}),l=new W({props:{title:"Remote Decode",local:"diffusers.utils.remote_decode",headingTag:"h2"}}),u=new K({props:{name:"diffusers.utils.remote_decode",anchor:"diffusers.utils.remote_decode",parameters:[{name:"endpoint",val:": str"},{name:"tensor",val:": torch.Tensor"},{name:"processor",val:": typing.Union[ForwardRef('VaeImageProcessor'), ForwardRef('VideoProcessor'), NoneType] = None"},{name:"do_scaling",val:": bool = True"},{name:"scaling_factor",val:": typing.Optional[float] = None"},{name:"shift_factor",val:": typing.Optional[float] = None"},{name:"output_type",val:": typing.Literal['mp4', 'pil', 'pt'] = 'pil'"},{name:"return_type",val:": typing.Literal['mp4', 'pil', 'pt'] = 'pil'"},{name:"image_format",val:": typing.Literal['png', 'jpg'] = 'jpg'"},{name:"partial_postprocess",val:": bool = False"},{name:"input_tensor_type",val:": typing.Literal['binary'] = 'binary'"},{name:"output_tensor_type",val:": typing.Literal['binary'] = 'binary'"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.utils.remote_decode.endpoint",description:`<strong>endpoint</strong> (<code>str</code>) &#x2014;
Endpoint for Remote Decode.`,name:"endpoint"},{anchor:"diffusers.utils.remote_decode.tensor",description:`<strong>tensor</strong> (<code>torch.Tensor</code>) &#x2014;
Tensor to be decoded.`,name:"tensor"},{anchor:"diffusers.utils.remote_decode.processor",description:`<strong>processor</strong> (<code>VaeImageProcessor</code> or <code>VideoProcessor</code>, <em>optional</em>) &#x2014;
Used with <code>return_type=&quot;pt&quot;</code>, and <code>return_type=&quot;pil&quot;</code> for Video models.`,name:"processor"},{anchor:"diffusers.utils.remote_decode.do_scaling",description:`<strong>do_scaling</strong> (<code>bool</code>, default <code>True</code>, <em>optional</em>) &#x2014;
<strong>DEPRECATED</strong>. <strong>pass <code>scaling_factor</code>/<code>shift_factor</code> instead.</strong> <strong>still set
do_scaling=None/do_scaling=False for no scaling until option is removed</strong> When <code>True</code> scaling e.g. <code>latents / self.vae.config.scaling_factor</code> is applied remotely. If <code>False</code>, input must be passed with scaling
applied.`,name:"do_scaling"},{anchor:"diffusers.utils.remote_decode.scaling_factor",description:`<strong>scaling_factor</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Scaling is applied when passed e.g. <a href="https://github.com/huggingface/diffusers/blob/7007febae5cff000d4df9059d9cf35133e8b2ca9/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L1083C37-L1083C77" rel="nofollow"><code>latents / self.vae.config.scaling_factor</code></a>.</p>
<ul>
<li>SD v1: 0.18215</li>
<li>SD XL: 0.13025</li>
<li>Flux: 0.3611
If <code>None</code>, input must be passed with scaling applied.</li>
</ul>`,name:"scaling_factor"},{anchor:"diffusers.utils.remote_decode.shift_factor",description:`<strong>shift_factor</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Shift is applied when passed e.g. <code>latents + self.vae.config.shift_factor</code>.</p>
<ul>
<li>Flux: 0.1159
If <code>None</code>, input must be passed with scaling applied.</li>
</ul>`,name:"shift_factor"},{anchor:"diffusers.utils.remote_decode.output_type",description:`<strong>output_type</strong> (<code>&quot;mp4&quot;</code> or <code>&quot;pil&quot;</code> or <code>&quot;pt&quot;, default </code>&#x201C;pil&#x201D;) &#x2014;
<strong>Endpoint</strong> output type. Subject to change. Report feedback on preferred type.</p>
<p><code>&quot;mp4&quot;: Supported by video models. Endpoint returns </code>bytes<code>of video.</code>&#x201C;pil&#x201D;<code>: Supported by image and video models. Image models: Endpoint returns </code>bytes<code>of an image in</code>image_format<code>. Video models: Endpoint returns </code>torch.Tensor<code>with partial</code>postprocessing<code>applied. Requires</code>processor<code>as a flag (any</code>None<code>value will work).</code>&#x201C;pt&#x201D;<code>: Support by image and video models. Endpoint returns </code>torch.Tensor<code>. With </code>partial_postprocess=True<code>the tensor is postprocessed</code>uint8\` image tensor.</p>
<p>Recommendations:
<code>&quot;pt&quot;</code> with <code>partial_postprocess=True</code> is the smallest transfer for full quality. <code>&quot;pt&quot;</code> with
<code>partial_postprocess=False</code> is the most compatible with third party code. <code>&quot;pil&quot;</code> with
<code>image_format=&quot;jpg&quot;</code> is the smallest transfer overall.`,name:"output_type"},{anchor:"diffusers.utils.remote_decode.return_type",description:`<strong>return_type</strong> (<code>&quot;mp4&quot;</code> or <code>&quot;pil&quot;</code> or <code>&quot;pt&quot;, default </code>&#x201C;pil&#x201D;) &#x2014;
<strong>Function</strong> return type.</p>
<p><code>&quot;mp4&quot;: Function returns </code>bytes<code>of video.</code>&#x201C;pil&#x201D;<code>: Function returns </code>PIL.Image.Image<code>. With </code>output_type=&#x201C;pil&#x201D; no further processing is applied. With <code>output_type=&quot;pt&quot; a </code>PIL.Image.Image<code>is created.</code>partial_postprocess=False<code> </code>processor<code>is required.</code>partial_postprocess=True<code> </code>processor<code>is **not** required.</code>&#x201C;pt&#x201D;<code>: Function returns </code>torch.Tensor<code>. </code>processor<code>is **not** required.</code>partial_postprocess=False<code>tensor is</code>float16<code>or</code>bfloat16<code>, without denormalization. </code>partial_postprocess=True<code>tensor is</code>uint8\`, denormalized.`,name:"return_type"},{anchor:"diffusers.utils.remote_decode.image_format",description:`<strong>image_format</strong> (<code>&quot;png&quot;</code> or <code>&quot;jpg&quot;</code>, default <code>jpg</code>) &#x2014;
Used with <code>output_type=&quot;pil&quot;</code>. Endpoint returns <code>jpg</code> or <code>png</code>.`,name:"image_format"},{anchor:"diffusers.utils.remote_decode.partial_postprocess",description:`<strong>partial_postprocess</strong> (<code>bool</code>, default <code>False</code>) &#x2014;
Used with <code>output_type=&quot;pt&quot;</code>. <code>partial_postprocess=False</code> tensor is <code>float16</code> or <code>bfloat16</code>, without
denormalization. <code>partial_postprocess=True</code> tensor is <code>uint8</code>, denormalized.`,name:"partial_postprocess"},{anchor:"diffusers.utils.remote_decode.input_tensor_type",description:`<strong>input_tensor_type</strong> (<code>&quot;binary&quot;</code>, default <code>&quot;binary&quot;</code>) &#x2014;
Tensor transfer type.`,name:"input_tensor_type"},{anchor:"diffusers.utils.remote_decode.output_tensor_type",description:`<strong>output_tensor_type</strong> (<code>&quot;binary&quot;</code>, default <code>&quot;binary&quot;</code>) &#x2014;
Tensor transfer type.`,name:"output_tensor_type"},{anchor:"diffusers.utils.remote_decode.height",description:`<strong>height</strong> (<code>int</code>, <strong>optional</strong>) &#x2014;
Required for <code>&quot;packed&quot;</code> latents.`,name:"height"},{anchor:"diffusers.utils.remote_decode.width",description:`<strong>width</strong> (<code>int</code>, <strong>optional</strong>) &#x2014;
Required for <code>&quot;packed&quot;</code> latents.`,name:"width"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/remote_utils.py#L188",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>output (<code>Image.Image</code> or <code>List[Image.Image]</code> or <code>bytes</code> or <code>torch.Tensor</code>).</p>
`}}),f=new W({props:{title:"Remote Encode",local:"diffusers.utils.remote_utils.remote_encode",headingTag:"h2"}}),m=new K({props:{name:"diffusers.utils.remote_utils.remote_encode",anchor:"diffusers.utils.remote_utils.remote_encode",parameters:[{name:"endpoint",val:": str"},{name:"image",val:": typing.Union[ForwardRef('torch.Tensor'), PIL.Image.Image]"},{name:"scaling_factor",val:": typing.Optional[float] = None"},{name:"shift_factor",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.utils.remote_utils.remote_encode.endpoint",description:`<strong>endpoint</strong> (<code>str</code>) &#x2014;
Endpoint for Remote Decode.`,name:"endpoint"},{anchor:"diffusers.utils.remote_utils.remote_encode.image",description:`<strong>image</strong> (<code>torch.Tensor</code> or <code>PIL.Image.Image</code>) &#x2014;
Image to be encoded.`,name:"image"},{anchor:"diffusers.utils.remote_utils.remote_encode.scaling_factor",description:`<strong>scaling_factor</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Scaling is applied when passed e.g. <code>latents * self.vae.config.scaling_factor</code>.<ul>
<li>SD v1: 0.18215</li>
<li>SD XL: 0.13025</li>
<li>Flux: 0.3611
If <code>None</code>, input must be passed with scaling applied.</li>
</ul>`,name:"scaling_factor"},{anchor:"diffusers.utils.remote_utils.remote_encode.shift_factor",description:`<strong>shift_factor</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Shift is applied when passed e.g. <code>latents - self.vae.config.shift_factor</code>.<ul>
<li>Flux: 0.1159
If <code>None</code>, input must be passed with scaling applied.</li>
</ul>`,name:"shift_factor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/remote_utils.py#L380",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>output (<code>torch.Tensor</code>).</p>
`}}),g=new re({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/hybrid_inference/api_reference.md"}}),{c(){i=_("meta"),F=r(),T=_("p"),C=r(),h(a.$$.fragment),L=r(),h(p.$$.fragment),P=r(),h(l.$$.fragment),R=r(),d=_("div"),h(u.$$.fragment),U=r(),w=_("p"),w.textContent=G,S=r(),h(f.$$.fragment),N=r(),c=_("div"),h(m.$$.fragment),M=r(),I=_("p"),I.textContent=B,V=r(),h(g.$$.fragment),j=r(),D=_("p"),this.h()},l(e){const o=te("svelte-u9bgzb",document.head);i=y(o,"META",{name:!0,content:!0}),o.forEach(t),F=s(e),T=y(e,"P",{}),z(T).forEach(t),C=s(e),b(a.$$.fragment,e),L=s(e),b(p.$$.fragment,e),P=s(e),b(l.$$.fragment,e),R=s(e),d=y(e,"DIV",{class:!0});var O=z(d);b(u.$$.fragment,O),U=s(O),w=y(O,"P",{"data-svelte-h":!0}),J(w)!=="svelte-1102kvv"&&(w.textContent=G),O.forEach(t),S=s(e),b(f.$$.fragment,e),N=s(e),c=y(e,"DIV",{class:!0});var k=z(c);b(m.$$.fragment,k),M=s(k),I=y(k,"P",{"data-svelte-h":!0}),J(I)!=="svelte-ju55g7"&&(I.textContent=B),k.forEach(t),V=s(e),b(g.$$.fragment,e),j=s(e),D=y(e,"P",{}),z(D).forEach(t),this.h()},h(){A(i,"name","hf:doc:metadata"),A(i,"content",ie),A(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(c,"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,o){E(document.head,i),n(e,F,o),n(e,T,o),n(e,C,o),q(a,e,o),n(e,L,o),q(p,e,o),n(e,P,o),q(l,e,o),n(e,R,o),n(e,d,o),q(u,d,null),E(d,U),E(d,w),n(e,S,o),q(f,e,o),n(e,N,o),n(e,c,o),q(m,c,null),E(c,M),E(c,I),n(e,V,o),q(g,e,o),n(e,j,o),n(e,D,o),H=!0},p:Y,i(e){H||($(a.$$.fragment,e),$(p.$$.fragment,e),$(l.$$.fragment,e),$(u.$$.fragment,e),$(f.$$.fragment,e),$(m.$$.fragment,e),$(g.$$.fragment,e),H=!0)},o(e){x(a.$$.fragment,e),x(p.$$.fragment,e),x(l.$$.fragment,e),x(u.$$.fragment,e),x(f.$$.fragment,e),x(m.$$.fragment,e),x(g.$$.fragment,e),H=!1},d(e){e&&(t(F),t(T),t(C),t(L),t(P),t(R),t(d),t(S),t(N),t(c),t(V),t(j),t(D)),t(i),v(a,e),v(p,e),v(l,e),v(u),v(f,e),v(m),v(g,e)}}}const ie='{"title":"Hybrid Inference API Reference","local":"hybrid-inference-api-reference","sections":[{"title":"Remote Decode","local":"diffusers.utils.remote_decode","sections":[],"depth":2},{"title":"Remote Encode","local":"diffusers.utils.remote_utils.remote_encode","sections":[],"depth":2}],"depth":1}';function de(X){return Z(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fe extends ee{constructor(i){super(),oe(this,i,de,se,Q,{})}}export{fe as component};
