import{s as k,n as A,o as H}from"../chunks/scheduler.8c3d61f6.js";import{S as z,i as O,g,s as p,r as I,A as U,h as _,f as t,c as l,j as R,u as T,x as W,k as L,y as S,a as s,v as D,d as E,t as F,w as P}from"../chunks/index.da70eac4.js";import{D as M}from"../chunks/Docstring.6b390b9a.js";import{H as V,E as G}from"../chunks/EditOnGithub.1e64e623.js";function X(N){let n,h,f,y,d,q,i,b,r,c,C,u,j="Hugging Face Hybrid Inference that allow running VAE decode remotely.",x,a,v,m,w;return d=new V({props:{title:"Hybrid Inference API Reference",local:"hybrid-inference-api-reference",headingTag:"h1"}}),i=new V({props:{title:"Remote Decode",local:"diffusers.utils.remote_decode",headingTag:"h2"}}),c=new M({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>
`}}),a=new G({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/hybrid_inference/api_reference.md"}}),{c(){n=g("meta"),h=p(),f=g("p"),y=p(),I(d.$$.fragment),q=p(),I(i.$$.fragment),b=p(),r=g("div"),I(c.$$.fragment),C=p(),u=g("p"),u.textContent=j,x=p(),I(a.$$.fragment),v=p(),m=g("p"),this.h()},l(e){const o=U("svelte-u9bgzb",document.head);n=_(o,"META",{name:!0,content:!0}),o.forEach(t),h=l(e),f=_(e,"P",{}),R(f).forEach(t),y=l(e),T(d.$$.fragment,e),q=l(e),T(i.$$.fragment,e),b=l(e),r=_(e,"DIV",{class:!0});var $=R(r);T(c.$$.fragment,$),C=l($),u=_($,"P",{"data-svelte-h":!0}),W(u)!=="svelte-1102kvv"&&(u.textContent=j),$.forEach(t),x=l(e),T(a.$$.fragment,e),v=l(e),m=_(e,"P",{}),R(m).forEach(t),this.h()},h(){L(n,"name","hf:doc:metadata"),L(n,"content",B),L(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,o){S(document.head,n),s(e,h,o),s(e,f,o),s(e,y,o),D(d,e,o),s(e,q,o),D(i,e,o),s(e,b,o),s(e,r,o),D(c,r,null),S(r,C),S(r,u),s(e,x,o),D(a,e,o),s(e,v,o),s(e,m,o),w=!0},p:A,i(e){w||(E(d.$$.fragment,e),E(i.$$.fragment,e),E(c.$$.fragment,e),E(a.$$.fragment,e),w=!0)},o(e){F(d.$$.fragment,e),F(i.$$.fragment,e),F(c.$$.fragment,e),F(a.$$.fragment,e),w=!1},d(e){e&&(t(h),t(f),t(y),t(q),t(b),t(r),t(x),t(v),t(m)),t(n),P(d,e),P(i,e),P(c),P(a,e)}}}const B='{"title":"Hybrid Inference API Reference","local":"hybrid-inference-api-reference","sections":[{"title":"Remote Decode","local":"diffusers.utils.remote_decode","sections":[],"depth":2}],"depth":1}';function J(N){return H(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ee extends z{constructor(n){super(),O(this,n,J,X,k,{})}}export{ee as component};
