import{s as Oe,n as Ee,o as He}from"../chunks/scheduler.53228c21.js";import{S as Ie,i as je,e as o,s,c as p,h as qe,a as d,d as t,b as r,f as j,g as u,j as m,k as q,l as a,m as i,n as f,t as h,o as g,p as _}from"../chunks/index.100fac89.js";import{C as Ae}from"../chunks/CopyLLMTxtMenu.20a72e0e.js";import{D as B}from"../chunks/Docstring.49101787.js";import{H as xe,E as Ne}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4d82655d.js";function ze(Pe){let b,J,U,K,T,Q,R,X,S,Te='<code>RePaintScheduler</code> is a DDPM-based inpainting scheduler for unsupervised inpainting with extreme masks. It is designed to be used with the <code>RePaintPipeline</code>, and it is based on the paper <a href="https://huggingface.co/papers/2201.09865" rel="nofollow">RePaint: Inpainting using Denoising Diffusion Probabilistic Models</a> by Andreas Lugmayr et al.',Y,w,Re="The abstract from the paper is:",Z,y,Se='<em>Free-form inpainting is the task of adding new content to an image in the regions specified by an arbitrary binary mask. Most existing approaches train for a certain distribution of masks, which limits their generalization capabilities to unseen mask types. Furthermore, training with pixel-wise and perceptual losses often leads to simple textural extensions towards the missing areas instead of semantically meaningful generation. In this work, we propose RePaint: A Denoising Diffusion Probabilistic Model (DDPM) based inpainting approach that is applicable to even extreme masks. We employ a pretrained unconditional DDPM as the generative prior. To condition the generation process, we only alter the reverse diffusion iterations by sampling the unmasked regions using the given image information. Since this technique does not modify or condition the original DDPM network itself, the model produces high-quality and diverse output images for any inpainting form. We validate our method for both faces and general-purpose image inpainting using standard and extreme masks. RePaint outperforms state-of-the-art Autoregressive, and GAN approaches for at least five out of six mask distributions. GitHub Repository: <a href="http://git.io/RePaint" rel="nofollow">this http URL</a>.</em>',ee,D,we='The original implementation can be found at <a href="https://github.com/andreas128/" rel="nofollow">andreas128/RePaint</a>.',te,C,ne,l,k,ue,A,ye="<code>RePaintScheduler</code> is a scheduler for DDPM inpainting inside a given mask.",me,N,De=`This model inherits from <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin">ConfigMixin</a>. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`,fe,$,M,he,z,Ce=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,ge,x,L,_e,G,ke="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",be,P,O,ve,V,Me=`Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
process from the learned model outputs (most often the predicted noise).`,se,E,re,v,H,$e,F,Le="Output class for the scheduler’s step function output.",ie,I,ae,W,oe;return T=new Ae({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),R=new xe({props:{title:"RePaintScheduler",local:"repaintscheduler",headingTag:"h1"}}),C=new xe({props:{title:"RePaintScheduler",local:"diffusers.RePaintScheduler",headingTag:"h2"}}),k=new B({props:{name:"class diffusers.RePaintScheduler",anchor:"diffusers.RePaintScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.0001"},{name:"beta_end",val:": float = 0.02"},{name:"beta_schedule",val:": str = 'linear'"},{name:"eta",val:": float = 0.0"},{name:"trained_betas",val:": typing.Optional[numpy.ndarray] = None"},{name:"clip_sample",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.RePaintScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 1000) &#x2014;
The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.RePaintScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) &#x2014;
The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.RePaintScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.02) &#x2014;
The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.RePaintScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
<code>linear</code>, <code>scaled_linear</code>, <code>squaredcos_cap_v2</code>, or <code>sigmoid</code>.`,name:"beta_schedule"},{anchor:"diffusers.RePaintScheduler.eta",description:`<strong>eta</strong> (<code>float</code>) &#x2014;
The weight of noise for added noise in diffusion step. If its value is between 0.0 and 1.0 it corresponds
to the DDIM scheduler, and if its value is between -0.0 and 1.0 it corresponds to the DDPM scheduler.`,name:"eta"},{anchor:"diffusers.RePaintScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, <em>optional</em>) &#x2014;
Pass an array of betas directly to the constructor to bypass <code>beta_start</code> and <code>beta_end</code>.`,name:"trained_betas"},{anchor:"diffusers.RePaintScheduler.clip_sample",description:`<strong>clip_sample</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Clip the predicted sample between -1 and 1 for numerical stability.`,name:"clip_sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_repaint.py#L92"}}),M=new B({props:{name:"scale_model_input",anchor:"diffusers.RePaintScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.RePaintScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.RePaintScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The current timestep in the diffusion chain.`,name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_repaint.py#L164",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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


<p><code>torch.Tensor</code></p>
`}}),L=new B({props:{name:"set_timesteps",anchor:"diffusers.RePaintScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"jump_length",val:": int = 10"},{name:"jump_n_sample",val:": int = 10"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.RePaintScheduler.set_timesteps.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>) &#x2014;
The number of diffusion steps used when generating samples with a pre-trained model. If used,
<code>timesteps</code> must be <code>None</code>.`,name:"num_inference_steps"},{anchor:"diffusers.RePaintScheduler.set_timesteps.jump_length",description:`<strong>jump_length</strong> (<code>int</code>, defaults to 10) &#x2014;
The number of steps taken forward in time before going backward in time for a single jump (&#x201C;j&#x201D; in
RePaint paper). Take a look at Figure 9 and 10 in the paper.`,name:"jump_length"},{anchor:"diffusers.RePaintScheduler.set_timesteps.jump_n_sample",description:`<strong>jump_n_sample</strong> (<code>int</code>, defaults to 10) &#x2014;
The number of times to make a forward time jump for a given chosen time sample. Take a look at Figure 9
and 10 in the paper.`,name:"jump_n_sample"},{anchor:"diffusers.RePaintScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>, <em>optional</em>) &#x2014;
The device to which the timesteps should be moved to. If <code>None</code>, the timesteps are not moved.`,name:"device"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_repaint.py#L181"}}),O=new B({props:{name:"step",anchor:"diffusers.RePaintScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": int"},{name:"sample",val:": Tensor"},{name:"original_image",val:": Tensor"},{name:"mask",val:": Tensor"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.RePaintScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.RePaintScheduler.step.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.RePaintScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.RePaintScheduler.step.original_image",description:`<strong>original_image</strong> (<code>torch.Tensor</code>) &#x2014;
The original image to inpaint on.`,name:"original_image"},{anchor:"diffusers.RePaintScheduler.step.mask",description:`<strong>mask</strong> (<code>torch.Tensor</code>) &#x2014;
The mask where a value of 0.0 indicates which part of the original image to inpaint.`,name:"mask"},{anchor:"diffusers.RePaintScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"},{anchor:"diffusers.RePaintScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/schedulers/repaint#diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput">RePaintSchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_repaint.py#L247",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/schedulers/repaint#diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput"
>RePaintSchedulerOutput</a> is returned,
otherwise a tuple is returned where the first element is the sample tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/schedulers/repaint#diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput"
>RePaintSchedulerOutput</a> or <code>tuple</code></p>
`}}),E=new xe({props:{title:"RePaintSchedulerOutput",local:"diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput",headingTag:"h2"}}),H=new B({props:{name:"class diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput",anchor:"diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput",parameters:[{name:"prev_sample",val:": Tensor"},{name:"pred_original_sample",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
Computed sample (x_{t-1}) of previous timestep. <code>prev_sample</code> should be used as next model input in the
denoising loop.`,name:"prev_sample"},{anchor:"diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput.pred_original_sample",description:`<strong>pred_original_sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
The predicted denoised sample (x_{0}) based on the model output from
the current timestep. <code>pred_original_sample</code> can be used to preview progress or for guidance.`,name:"pred_original_sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_repaint.py#L29"}}),I=new Ne({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/repaint.md"}}),{c(){b=o("meta"),J=s(),U=o("p"),K=s(),p(T.$$.fragment),Q=s(),p(R.$$.fragment),X=s(),S=o("p"),S.innerHTML=Te,Y=s(),w=o("p"),w.textContent=Re,Z=s(),y=o("p"),y.innerHTML=Se,ee=s(),D=o("p"),D.innerHTML=we,te=s(),p(C.$$.fragment),ne=s(),l=o("div"),p(k.$$.fragment),ue=s(),A=o("p"),A.innerHTML=ye,me=s(),N=o("p"),N.innerHTML=De,fe=s(),$=o("div"),p(M.$$.fragment),he=s(),z=o("p"),z.textContent=Ce,ge=s(),x=o("div"),p(L.$$.fragment),_e=s(),G=o("p"),G.textContent=ke,be=s(),P=o("div"),p(O.$$.fragment),ve=s(),V=o("p"),V.textContent=Me,se=s(),p(E.$$.fragment),re=s(),v=o("div"),p(H.$$.fragment),$e=s(),F=o("p"),F.textContent=Le,ie=s(),p(I.$$.fragment),ae=s(),W=o("p"),this.h()},l(e){const n=qe("svelte-u9bgzb",document.head);b=d(n,"META",{name:!0,content:!0}),n.forEach(t),J=r(e),U=d(e,"P",{}),j(U).forEach(t),K=r(e),u(T.$$.fragment,e),Q=r(e),u(R.$$.fragment,e),X=r(e),S=d(e,"P",{"data-svelte-h":!0}),m(S)!=="svelte-1svpq0s"&&(S.innerHTML=Te),Y=r(e),w=d(e,"P",{"data-svelte-h":!0}),m(w)!=="svelte-1cwsb16"&&(w.textContent=Re),Z=r(e),y=d(e,"P",{"data-svelte-h":!0}),m(y)!=="svelte-7o5mek"&&(y.innerHTML=Se),ee=r(e),D=d(e,"P",{"data-svelte-h":!0}),m(D)!=="svelte-1baf0s2"&&(D.innerHTML=we),te=r(e),u(C.$$.fragment,e),ne=r(e),l=d(e,"DIV",{class:!0});var c=j(l);u(k.$$.fragment,c),ue=r(c),A=d(c,"P",{"data-svelte-h":!0}),m(A)!=="svelte-1c6l7p4"&&(A.innerHTML=ye),me=r(c),N=d(c,"P",{"data-svelte-h":!0}),m(N)!=="svelte-linuuh"&&(N.innerHTML=De),fe=r(c),$=d(c,"DIV",{class:!0});var de=j($);u(M.$$.fragment,de),he=r(de),z=d(de,"P",{"data-svelte-h":!0}),m(z)!=="svelte-1rkfgpx"&&(z.textContent=Ce),de.forEach(t),ge=r(c),x=d(c,"DIV",{class:!0});var le=j(x);u(L.$$.fragment,le),_e=r(le),G=d(le,"P",{"data-svelte-h":!0}),m(G)!=="svelte-1vzm9q"&&(G.textContent=ke),le.forEach(t),be=r(c),P=d(c,"DIV",{class:!0});var ce=j(P);u(O.$$.fragment,ce),ve=r(ce),V=d(ce,"P",{"data-svelte-h":!0}),m(V)!=="svelte-hi84tp"&&(V.textContent=Me),ce.forEach(t),c.forEach(t),se=r(e),u(E.$$.fragment,e),re=r(e),v=d(e,"DIV",{class:!0});var pe=j(v);u(H.$$.fragment,pe),$e=r(pe),F=d(pe,"P",{"data-svelte-h":!0}),m(F)!=="svelte-7snghh"&&(F.textContent=Le),pe.forEach(t),ie=r(e),u(I.$$.fragment,e),ae=r(e),W=d(e,"P",{}),j(W).forEach(t),this.h()},h(){q(b,"name","hf:doc:metadata"),q(b,"content",Ge),q($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(v,"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,n){a(document.head,b),i(e,J,n),i(e,U,n),i(e,K,n),f(T,e,n),i(e,Q,n),f(R,e,n),i(e,X,n),i(e,S,n),i(e,Y,n),i(e,w,n),i(e,Z,n),i(e,y,n),i(e,ee,n),i(e,D,n),i(e,te,n),f(C,e,n),i(e,ne,n),i(e,l,n),f(k,l,null),a(l,ue),a(l,A),a(l,me),a(l,N),a(l,fe),a(l,$),f(M,$,null),a($,he),a($,z),a(l,ge),a(l,x),f(L,x,null),a(x,_e),a(x,G),a(l,be),a(l,P),f(O,P,null),a(P,ve),a(P,V),i(e,se,n),f(E,e,n),i(e,re,n),i(e,v,n),f(H,v,null),a(v,$e),a(v,F),i(e,ie,n),f(I,e,n),i(e,ae,n),i(e,W,n),oe=!0},p:Ee,i(e){oe||(h(T.$$.fragment,e),h(R.$$.fragment,e),h(C.$$.fragment,e),h(k.$$.fragment,e),h(M.$$.fragment,e),h(L.$$.fragment,e),h(O.$$.fragment,e),h(E.$$.fragment,e),h(H.$$.fragment,e),h(I.$$.fragment,e),oe=!0)},o(e){g(T.$$.fragment,e),g(R.$$.fragment,e),g(C.$$.fragment,e),g(k.$$.fragment,e),g(M.$$.fragment,e),g(L.$$.fragment,e),g(O.$$.fragment,e),g(E.$$.fragment,e),g(H.$$.fragment,e),g(I.$$.fragment,e),oe=!1},d(e){e&&(t(J),t(U),t(K),t(Q),t(X),t(S),t(Y),t(w),t(Z),t(y),t(ee),t(D),t(te),t(ne),t(l),t(se),t(re),t(v),t(ie),t(ae),t(W)),t(b),_(T,e),_(R,e),_(C,e),_(k),_(M),_(L),_(O),_(E,e),_(H),_(I,e)}}}const Ge='{"title":"RePaintScheduler","local":"repaintscheduler","sections":[{"title":"RePaintScheduler","local":"diffusers.RePaintScheduler","sections":[],"depth":2},{"title":"RePaintSchedulerOutput","local":"diffusers.schedulers.scheduling_repaint.RePaintSchedulerOutput","sections":[],"depth":2}],"depth":1}';function Ve(Pe){return He(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ke extends Ie{constructor(b){super(),je(this,b,Ve,ze,Oe,{})}}export{Ke as component};
