import{s as me,n as pe,o as fe}from"../chunks/scheduler.182ea377.js";import{S as he,i as _e,g as i,s,r as T,A as ge,h as l,f as t,c as a,j as z,u as $,x as U,k as F,y as d,a as n,v as q,d as B,t as O,w as C}from"../chunks/index.abf12888.js";import{D as oe}from"../chunks/Docstring.93f6f462.js";import{H as ne}from"../chunks/Heading.16916d63.js";function be(se){let c,H,L,I,f,S,h,ae='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.',E,_,re="The abstract from the paper is:",A,g,ie='<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>',V,b,W,r,D,X,w,le="A 1D UNet model that takes a noisy sample and a timestep and returns a sample shaped output.",Y,y,de=`This model inherits from <a href="/docs/diffusers/v0.22.1/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).`,Z,m,v,ee,x,ce='The <a href="/docs/diffusers/v0.22.1/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a> forward method.',R,k,j,u,N,te,M,ue='The output of <a href="/docs/diffusers/v0.22.1/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a>.',G,P,J;return f=new ne({props:{title:"UNet1DModel",local:"unet1dmodel",headingTag:"h1"}}),b=new ne({props:{title:"UNet1DModel",local:"diffusers.UNet1DModel",headingTag:"h2"}}),D=new oe({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/v0.22.1/src/diffusers/models/unet_1d.py#L41"}}),v=new oe({props:{name:"forward",anchor:"diffusers.UNet1DModel.forward",parameters:[{name:"sample",val:": FloatTensor"},{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.FloatTensor</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.FloatTensor</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/v0.22.1/en/api/models/unet#diffusers.models.unet_1d.UNet1DOutput">UNet1DOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.1/src/diffusers/models/unet_1d.py#L195",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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