import{S as mt,i as ht,s as _t,e as n,k as c,w as W,t as i,M as gt,c as s,d as o,m as u,a,x as G,h as l,b as r,G as t,g as p,y as H,L as bt,q as R,o as V,B as J,v as vt}from"../../../chunks/vendor-hf-doc-builder.js";import{D as je}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as Ke}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function wt(Qe){let m,te,h,v,j,U,we,K,ke,oe,w,De,M,ye,Ne,ne,P,Ue,se,z,$,Me,T,$e,Te,ae,_,k,Q,x,xe,X,Ee,re,f,E,qe,Y,Ae,Se,q,Be,F,Ie,Oe,Pe,D,A,ze,S,Fe,C,Ce,Le,ie,g,y,Z,B,We,ee,Ge,le,b,I,He,O,Re,L,Ve,Je,de;return U=new Ke({}),x=new Ke({}),E=new je({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.21.0/src/diffusers/models/unet_1d.py#L41"}}),A=new je({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.21.0/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.21.0/src/diffusers/models/unet_1d.py#L195",returnDescription:`
<p>If <code>return_dict</code> is True, an <a
  href="/docs/diffusers/v0.21.0/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:`
<p><a
  href="/docs/diffusers/v0.21.0/en/api/models/unet#diffusers.models.unet_1d.UNet1DOutput"
>UNet1DOutput</a> or <code>tuple</code></p>
`}}),B=new Ke({}),I=new je({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.21.0/src/diffusers/models/unet_1d.py#L29"}}),{c(){m=n("meta"),te=c(),h=n("h1"),v=n("a"),j=n("span"),W(U.$$.fragment),we=c(),K=n("span"),ke=i("UNet1DModel"),oe=c(),w=n("p"),De=i("The "),M=n("a"),ye=i("UNet"),Ne=i(" model was originally introduced by Ronneberger et al for biomedical image segmentation, but it is also commonly used in \u{1F917} 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 \u{1F917} Diffusers, depending on it\u2019s number of dimensions and whether it is a conditional model or not. This is a 1D UNet model."),ne=c(),P=n("p"),Ue=i("The abstract from the paper is:"),se=c(),z=n("p"),$=n("em"),Me=i("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 "),T=n("a"),$e=i("http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net"),Te=i("."),ae=c(),_=n("h2"),k=n("a"),Q=n("span"),W(x.$$.fragment),xe=c(),X=n("span"),Ee=i("UNet1DModel"),re=c(),f=n("div"),W(E.$$.fragment),qe=c(),Y=n("p"),Ae=i("A 1D UNet model that takes a noisy sample and a timestep and returns a sample shaped output."),Se=c(),q=n("p"),Be=i("This model inherits from "),F=n("a"),Ie=i("ModelMixin"),Oe=i(`. Check the superclass documentation for it\u2019s generic methods implemented
for all models (such as downloading or saving).`),Pe=c(),D=n("div"),W(A.$$.fragment),ze=c(),S=n("p"),Fe=i("The "),C=n("a"),Ce=i("UNet1DModel"),Le=i(" forward method."),ie=c(),g=n("h2"),y=n("a"),Z=n("span"),W(B.$$.fragment),We=c(),ee=n("span"),Ge=i("UNet1DOutput"),le=c(),b=n("div"),W(I.$$.fragment),He=c(),O=n("p"),Re=i("The output of "),L=n("a"),Ve=i("UNet1DModel"),Je=i("."),this.h()},l(e){const d=gt('[data-svelte="svelte-1phssyn"]',document.head);m=s(d,"META",{name:!0,content:!0}),d.forEach(o),te=u(e),h=s(e,"H1",{class:!0});var ce=a(h);v=s(ce,"A",{id:!0,class:!0,href:!0});var Xe=a(v);j=s(Xe,"SPAN",{});var Ye=a(j);G(U.$$.fragment,Ye),Ye.forEach(o),Xe.forEach(o),we=u(ce),K=s(ce,"SPAN",{});var Ze=a(K);ke=l(Ze,"UNet1DModel"),Ze.forEach(o),ce.forEach(o),oe=u(e),w=s(e,"P",{});var ue=a(w);De=l(ue,"The "),M=s(ue,"A",{href:!0,rel:!0});var et=a(M);ye=l(et,"UNet"),et.forEach(o),Ne=l(ue," model was originally introduced by Ronneberger et al for biomedical image segmentation, but it is also commonly used in \u{1F917} 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 \u{1F917} Diffusers, depending on it\u2019s number of dimensions and whether it is a conditional model or not. This is a 1D UNet model."),ue.forEach(o),ne=u(e),P=s(e,"P",{});var tt=a(P);Ue=l(tt,"The abstract from the paper is:"),tt.forEach(o),se=u(e),z=s(e,"P",{});var ot=a(z);$=s(ot,"EM",{});var pe=a($);Me=l(pe,"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 "),T=s(pe,"A",{href:!0,rel:!0});var nt=a(T);$e=l(nt,"http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net"),nt.forEach(o),Te=l(pe,"."),pe.forEach(o),ot.forEach(o),ae=u(e),_=s(e,"H2",{class:!0});var fe=a(_);k=s(fe,"A",{id:!0,class:!0,href:!0});var st=a(k);Q=s(st,"SPAN",{});var at=a(Q);G(x.$$.fragment,at),at.forEach(o),st.forEach(o),xe=u(fe),X=s(fe,"SPAN",{});var rt=a(X);Ee=l(rt,"UNet1DModel"),rt.forEach(o),fe.forEach(o),re=u(e),f=s(e,"DIV",{class:!0});var N=a(f);G(E.$$.fragment,N),qe=u(N),Y=s(N,"P",{});var it=a(Y);Ae=l(it,"A 1D UNet model that takes a noisy sample and a timestep and returns a sample shaped output."),it.forEach(o),Se=u(N),q=s(N,"P",{});var me=a(q);Be=l(me,"This model inherits from "),F=s(me,"A",{href:!0});var lt=a(F);Ie=l(lt,"ModelMixin"),lt.forEach(o),Oe=l(me,`. Check the superclass documentation for it\u2019s generic methods implemented
for all models (such as downloading or saving).`),me.forEach(o),Pe=u(N),D=s(N,"DIV",{class:!0});var he=a(D);G(A.$$.fragment,he),ze=u(he),S=s(he,"P",{});var _e=a(S);Fe=l(_e,"The "),C=s(_e,"A",{href:!0});var dt=a(C);Ce=l(dt,"UNet1DModel"),dt.forEach(o),Le=l(_e," forward method."),_e.forEach(o),he.forEach(o),N.forEach(o),ie=u(e),g=s(e,"H2",{class:!0});var ge=a(g);y=s(ge,"A",{id:!0,class:!0,href:!0});var ct=a(y);Z=s(ct,"SPAN",{});var ut=a(Z);G(B.$$.fragment,ut),ut.forEach(o),ct.forEach(o),We=u(ge),ee=s(ge,"SPAN",{});var pt=a(ee);Ge=l(pt,"UNet1DOutput"),pt.forEach(o),ge.forEach(o),le=u(e),b=s(e,"DIV",{class:!0});var be=a(b);G(I.$$.fragment,be),He=u(be),O=s(be,"P",{});var ve=a(O);Re=l(ve,"The output of "),L=s(ve,"A",{href:!0});var ft=a(L);Ve=l(ft,"UNet1DModel"),ft.forEach(o),Je=l(ve,"."),ve.forEach(o),be.forEach(o),this.h()},h(){r(m,"name","hf:doc:metadata"),r(m,"content",JSON.stringify(kt)),r(v,"id","unet1dmodel"),r(v,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(v,"href","#unet1dmodel"),r(h,"class","relative group"),r(M,"href","https://huggingface.co/papers/1505.04597"),r(M,"rel","nofollow"),r(T,"href","http://lmb.informatik.uni-freiburg.de/people/ronneber/u-net"),r(T,"rel","nofollow"),r(k,"id","diffusers.UNet1DModel"),r(k,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(k,"href","#diffusers.UNet1DModel"),r(_,"class","relative group"),r(F,"href","/docs/diffusers/v0.21.0/en/api/models/overview#diffusers.ModelMixin"),r(C,"href","/docs/diffusers/v0.21.0/en/api/models/unet#diffusers.UNet1DModel"),r(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),r(y,"id","diffusers.models.unet_1d.UNet1DOutput"),r(y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(y,"href","#diffusers.models.unet_1d.UNet1DOutput"),r(g,"class","relative group"),r(L,"href","/docs/diffusers/v0.21.0/en/api/models/unet#diffusers.UNet1DModel"),r(b,"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,d){t(document.head,m),p(e,te,d),p(e,h,d),t(h,v),t(v,j),H(U,j,null),t(h,we),t(h,K),t(K,ke),p(e,oe,d),p(e,w,d),t(w,De),t(w,M),t(M,ye),t(w,Ne),p(e,ne,d),p(e,P,d),t(P,Ue),p(e,se,d),p(e,z,d),t(z,$),t($,Me),t($,T),t(T,$e),t($,Te),p(e,ae,d),p(e,_,d),t(_,k),t(k,Q),H(x,Q,null),t(_,xe),t(_,X),t(X,Ee),p(e,re,d),p(e,f,d),H(E,f,null),t(f,qe),t(f,Y),t(Y,Ae),t(f,Se),t(f,q),t(q,Be),t(q,F),t(F,Ie),t(q,Oe),t(f,Pe),t(f,D),H(A,D,null),t(D,ze),t(D,S),t(S,Fe),t(S,C),t(C,Ce),t(S,Le),p(e,ie,d),p(e,g,d),t(g,y),t(y,Z),H(B,Z,null),t(g,We),t(g,ee),t(ee,Ge),p(e,le,d),p(e,b,d),H(I,b,null),t(b,He),t(b,O),t(O,Re),t(O,L),t(L,Ve),t(O,Je),de=!0},p:bt,i(e){de||(R(U.$$.fragment,e),R(x.$$.fragment,e),R(E.$$.fragment,e),R(A.$$.fragment,e),R(B.$$.fragment,e),R(I.$$.fragment,e),de=!0)},o(e){V(U.$$.fragment,e),V(x.$$.fragment,e),V(E.$$.fragment,e),V(A.$$.fragment,e),V(B.$$.fragment,e),V(I.$$.fragment,e),de=!1},d(e){o(m),e&&o(te),e&&o(h),J(U),e&&o(oe),e&&o(w),e&&o(ne),e&&o(P),e&&o(se),e&&o(z),e&&o(ae),e&&o(_),J(x),e&&o(re),e&&o(f),J(E),J(A),e&&o(ie),e&&o(g),J(B),e&&o(le),e&&o(b),J(I)}}}const kt={local:"unet1dmodel",sections:[{local:"diffusers.UNet1DModel",title:"UNet1DModel"},{local:"diffusers.models.unet_1d.UNet1DOutput",title:"UNet1DOutput"}],title:"UNet1DModel"};function Dt(Qe){return vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Mt extends mt{constructor(m){super();ht(this,m,Dt,wt,_t,{})}}export{Mt as default,kt as metadata};
