import{s as fe,n as he,o as _e}from"../chunks/scheduler.8c3d61f6.js";import{S as ge,i as be,g as i,s,r as w,A as De,h as l,f as o,c as a,j as H,u as y,x as $,k as I,y as d,a as n,v as x,d as M,t as T,w as q}from"../chunks/index.da70eac4.js";import{D as se}from"../chunks/Docstring.a42c214b.js";import{H as ae,E as ke}from"../chunks/getInferenceSnippets.a8672208.js";function Ne(re){let c,S,P,E,f,A,h,ie='The <a href="https://huggingface.co/papers/1505.04597" rel="nofollow">UNet</a> model was originally introduced by Ronneberger et al. for biomedical image segmentation, but it is also commonly used in 🤗 Diffusers because it outputs images that are the same size as the input. It is one of the most important components of a diffusion system because it facilitates the actual diffusion process. There are several variants of the UNet model in 🤗 Diffusers, depending on it’s number of dimensions and whether it is a conditional model or not. This is a 1D UNet model.',F,_,le="The abstract from the paper is:",V,g,de='<em>There is large consent that successful training of deep networks requires many thousand annotated training samples. In this paper, we present a network and training strategy that relies on the strong use of data augmentation to use the available annotated samples more efficiently. The architecture consists of a contracting path to capture context and a symmetric expanding path that enables precise localization. We show that such a network can be trained end-to-end from very few images and outperforms the prior best method (a sliding-window convolutional network) on the ISBI challenge for segmentation of neuronal structures in electron microscopic stacks. Using the same network trained on transmitted light microscopy images (phase contrast and DIC) we won the ISBI cell tracking challenge 2015 in these categories by a large margin. Moreover, the network is fast. Segmentation of a 512x512 image takes less than a second on a recent GPU. The full implementation (based on Caffe) and the trained networks are available at <a href="http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net" rel="nofollow">http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net</a>.</em>',W,b,G,r,D,Z,B,ce="A 1D UNet model that takes a noisy sample and a timestep and returns a sample shaped output.",ee,O,ue=`This model inherits from <a href="/docs/diffusers/main/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a>. Check the superclass documentation for it’s generic methods implemented
for all models (such as downloading or saving).`,te,m,k,oe,C,me='The <a href="/docs/diffusers/main/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a> forward method.',R,N,j,u,U,ne,L,pe='The output of <a href="/docs/diffusers/main/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a>.',J,v,K,z,Q;return f=new ae({props:{title:"UNet1DModel",local:"unet1dmodel",headingTag:"h1"}}),b=new ae({props:{title:"UNet1DModel",local:"diffusers.UNet1DModel",headingTag:"h2"}}),D=new se({props:{name:"class diffusers.UNet1DModel",anchor:"diffusers.UNet1DModel",parameters:[{name:"sample_size",val:": int = 65536"},{name:"sample_rate",val:": typing.Optional[int] = None"},{name:"in_channels",val:": int = 2"},{name:"out_channels",val:": int = 2"},{name:"extra_in_channels",val:": int = 0"},{name:"time_embedding_type",val:": str = 'fourier'"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"use_timestep_embedding",val:": bool = False"},{name:"freq_shift",val:": float = 0.0"},{name:"down_block_types",val:": typing.Tuple[str] = ('DownBlock1DNoSkip', 'DownBlock1D', 'AttnDownBlock1D')"},{name:"up_block_types",val:": typing.Tuple[str] = ('AttnUpBlock1D', 'UpBlock1D', 'UpBlock1DNoSkip')"},{name:"mid_block_type",val:": typing.Tuple[str] = 'UNetMidBlock1D'"},{name:"out_block_type",val:": str = None"},{name:"block_out_channels",val:": typing.Tuple[int] = (32, 32, 64)"},{name:"act_fn",val:": str = None"},{name:"norm_num_groups",val:": int = 8"},{name:"layers_per_block",val:": int = 1"},{name:"downsample_each_block",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.UNet1DModel.sample_size",description:"<strong>sample_size</strong> (<code>int</code>, <em>optional</em>) &#x2014; Default length of sample. Should be adaptable at runtime.",name:"sample_size"},{anchor:"diffusers.UNet1DModel.in_channels",description:"<strong>in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014; Number of channels in the input sample.",name:"in_channels"},{anchor:"diffusers.UNet1DModel.out_channels",description:"<strong>out_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014; Number of channels in the output.",name:"out_channels"},{anchor:"diffusers.UNet1DModel.extra_in_channels",description:`<strong>extra_in_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of additional channels to be added to the input of the first down block. Useful for cases where the
input data has more channels than what the model was initially designed for.`,name:"extra_in_channels"},{anchor:"diffusers.UNet1DModel.time_embedding_type",description:"<strong>time_embedding_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;fourier&quot;</code>) &#x2014; Type of time embedding to use.",name:"time_embedding_type"},{anchor:"diffusers.UNet1DModel.freq_shift",description:"<strong>freq_shift</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014; Frequency shift for Fourier time embedding.",name:"freq_shift"},{anchor:"diffusers.UNet1DModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to flip sin to cos for Fourier time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.UNet1DModel.down_block_types",description:`<strong>down_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;DownBlock1DNoSkip&quot;, &quot;DownBlock1D&quot;, &quot;AttnDownBlock1D&quot;)</code>) &#x2014;
Tuple of downsample block types.`,name:"down_block_types"},{anchor:"diffusers.UNet1DModel.up_block_types",description:`<strong>up_block_types</strong> (<code>Tuple[str]</code>, <em>optional</em>, defaults to <code>(&quot;AttnUpBlock1D&quot;, &quot;UpBlock1D&quot;, &quot;UpBlock1DNoSkip&quot;)</code>) &#x2014;
Tuple of upsample block types.`,name:"up_block_types"},{anchor:"diffusers.UNet1DModel.block_out_channels",description:`<strong>block_out_channels</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to <code>(32, 32, 64)</code>) &#x2014;
Tuple of block output channels.`,name:"block_out_channels"},{anchor:"diffusers.UNet1DModel.mid_block_type",description:"<strong>mid_block_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;UNetMidBlock1D&quot;</code>) &#x2014; Block type for middle of UNet.",name:"mid_block_type"},{anchor:"diffusers.UNet1DModel.out_block_type",description:"<strong>out_block_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014; Optional output processing block of UNet.",name:"out_block_type"},{anchor:"diffusers.UNet1DModel.act_fn",description:"<strong>act_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014; Optional activation function in UNet blocks.",name:"act_fn"},{anchor:"diffusers.UNet1DModel.norm_num_groups",description:"<strong>norm_num_groups</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014; The number of groups for normalization.",name:"norm_num_groups"},{anchor:"diffusers.UNet1DModel.layers_per_block",description:"<strong>layers_per_block</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014; The number of layers per block.",name:"layers_per_block"},{anchor:"diffusers.UNet1DModel.downsample_each_block",description:`<strong>downsample_each_block</strong> (<code>int</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Experimental feature for using a UNet without upsampling.`,name:"downsample_each_block"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_1d.py#L41"}}),k=new se({props:{name:"forward",anchor:"diffusers.UNet1DModel.forward",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Union[torch.Tensor, float, int]"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.UNet1DModel.forward.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The noisy input tensor with the following shape <code>(batch_size, num_channels, sample_size)</code>.`,name:"sample"},{anchor:"diffusers.UNet1DModel.forward.timestep",description:"<strong>timestep</strong> (<code>torch.Tensor</code> or <code>float</code> or <code>int</code>) &#x2014; The number of timesteps to denoise an input.",name:"timestep"},{anchor:"diffusers.UNet1DModel.forward.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/models/unet#diffusers.models.unets.unet_1d.UNet1DOutput">UNet1DOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_1d.py#L197",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is True, an <a
  href="/docs/diffusers/main/en/api/models/unet#diffusers.models.unets.unet_1d.UNet1DOutput"
>UNet1DOutput</a> is returned, otherwise a <code>tuple</code> 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/models/unet#diffusers.models.unets.unet_1d.UNet1DOutput"
>UNet1DOutput</a> or <code>tuple</code></p>
`}}),N=new ae({props:{title:"UNet1DOutput",local:"diffusers.models.unets.unet_1d.UNet1DOutput",headingTag:"h2"}}),U=new se({props:{name:"class diffusers.models.unets.unet_1d.UNet1DOutput",anchor:"diffusers.models.unets.unet_1d.UNet1DOutput",parameters:[{name:"sample",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.models.unets.unet_1d.UNet1DOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, sample_size)</code>) &#x2014;
The hidden states output from the last layer of the model.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_1d.py#L28"}}),v=new ke({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/unet.md"}}),{c(){c=i("meta"),S=s(),P=i("p"),E=s(),w(f.$$.fragment),A=s(),h=i("p"),h.innerHTML=ie,F=s(),_=i("p"),_.textContent=le,V=s(),g=i("p"),g.innerHTML=de,W=s(),w(b.$$.fragment),G=s(),r=i("div"),w(D.$$.fragment),Z=s(),B=i("p"),B.textContent=ce,ee=s(),O=i("p"),O.innerHTML=ue,te=s(),m=i("div"),w(k.$$.fragment),oe=s(),C=i("p"),C.innerHTML=me,R=s(),w(N.$$.fragment),j=s(),u=i("div"),w(U.$$.fragment),ne=s(),L=i("p"),L.innerHTML=pe,J=s(),w(v.$$.fragment),K=s(),z=i("p"),this.h()},l(e){const t=De("svelte-u9bgzb",document.head);c=l(t,"META",{name:!0,content:!0}),t.forEach(o),S=a(e),P=l(e,"P",{}),H(P).forEach(o),E=a(e),y(f.$$.fragment,e),A=a(e),h=l(e,"P",{"data-svelte-h":!0}),$(h)!=="svelte-1md5hd4"&&(h.innerHTML=ie),F=a(e),_=l(e,"P",{"data-svelte-h":!0}),$(_)!=="svelte-1cwsb16"&&(_.textContent=le),V=a(e),g=l(e,"P",{"data-svelte-h":!0}),$(g)!=="svelte-12epiox"&&(g.innerHTML=de),W=a(e),y(b.$$.fragment,e),G=a(e),r=l(e,"DIV",{class:!0});var p=H(r);y(D.$$.fragment,p),Z=a(p),B=l(p,"P",{"data-svelte-h":!0}),$(B)!=="svelte-1afci55"&&(B.textContent=ce),ee=a(p),O=l(p,"P",{"data-svelte-h":!0}),$(O)!=="svelte-1hyu2ru"&&(O.innerHTML=ue),te=a(p),m=l(p,"DIV",{class:!0});var X=H(m);y(k.$$.fragment,X),oe=a(X),C=l(X,"P",{"data-svelte-h":!0}),$(C)!=="svelte-1nx8e33"&&(C.innerHTML=me),X.forEach(o),p.forEach(o),R=a(e),y(N.$$.fragment,e),j=a(e),u=l(e,"DIV",{class:!0});var Y=H(u);y(U.$$.fragment,Y),ne=a(Y),L=l(Y,"P",{"data-svelte-h":!0}),$(L)!=="svelte-dgf5oz"&&(L.innerHTML=pe),Y.forEach(o),J=a(e),y(v.$$.fragment,e),K=a(e),z=l(e,"P",{}),H(z).forEach(o),this.h()},h(){I(c,"name","hf:doc:metadata"),I(c,"content",Ue),I(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),I(r,"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")},m(e,t){d(document.head,c),n(e,S,t),n(e,P,t),n(e,E,t),x(f,e,t),n(e,A,t),n(e,h,t),n(e,F,t),n(e,_,t),n(e,V,t),n(e,g,t),n(e,W,t),x(b,e,t),n(e,G,t),n(e,r,t),x(D,r,null),d(r,Z),d(r,B),d(r,ee),d(r,O),d(r,te),d(r,m),x(k,m,null),d(m,oe),d(m,C),n(e,R,t),x(N,e,t),n(e,j,t),n(e,u,t),x(U,u,null),d(u,ne),d(u,L),n(e,J,t),x(v,e,t),n(e,K,t),n(e,z,t),Q=!0},p:he,i(e){Q||(M(f.$$.fragment,e),M(b.$$.fragment,e),M(D.$$.fragment,e),M(k.$$.fragment,e),M(N.$$.fragment,e),M(U.$$.fragment,e),M(v.$$.fragment,e),Q=!0)},o(e){T(f.$$.fragment,e),T(b.$$.fragment,e),T(D.$$.fragment,e),T(k.$$.fragment,e),T(N.$$.fragment,e),T(U.$$.fragment,e),T(v.$$.fragment,e),Q=!1},d(e){e&&(o(S),o(P),o(E),o(A),o(h),o(F),o(_),o(V),o(g),o(W),o(G),o(r),o(R),o(j),o(u),o(J),o(K),o(z)),o(c),q(f,e),q(b,e),q(D),q(k),q(N,e),q(U),q(v,e)}}}const Ue='{"title":"UNet1DModel","local":"unet1dmodel","sections":[{"title":"UNet1DModel","local":"diffusers.UNet1DModel","sections":[],"depth":2},{"title":"UNet1DOutput","local":"diffusers.models.unets.unet_1d.UNet1DOutput","sections":[],"depth":2}],"depth":1}';function ve(re){return _e(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Me extends ge{constructor(c){super(),be(this,c,ve,Ne,fe,{})}}export{Me as component};
