import{S as ft,i as ht,s as _t,e as n,k as c,w as W,t as i,M as gt,c as a,d as o,m as u,a as s,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 f,te,h,v,j,U,we,K,ke,oe,w,De,M,ye,Ne,ne,P,Ue,ae,z,$,Me,T,$e,Te,se,_,k,Q,x,xe,X,Ee,re,m,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/main/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/main/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/main/src/diffusers/models/unet_1d.py#L195",returnDescription:`
<p>If <code>return_dict</code> is True, an <a
  href="/docs/diffusers/main/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/main/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/main/src/diffusers/models/unet_1d.py#L29"}}),{c(){f=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:"),ae=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("."),se=c(),_=n("h2"),k=n("a"),Q=n("span"),W(x.$$.fragment),xe=c(),X=n("span"),Ee=i("UNet1DModel"),re=c(),m=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);f=a(d,"META",{name:!0,content:!0}),d.forEach(o),te=u(e),h=a(e,"H1",{class:!0});var ce=s(h);v=a(ce,"A",{id:!0,class:!0,href:!0});var Xe=s(v);j=a(Xe,"SPAN",{});var Ye=s(j);G(U.$$.fragment,Ye),Ye.forEach(o),Xe.forEach(o),we=u(ce),K=a(ce,"SPAN",{});var Ze=s(K);ke=l(Ze,"UNet1DModel"),Ze.forEach(o),ce.forEach(o),oe=u(e),w=a(e,"P",{});var ue=s(w);De=l(ue,"The "),M=a(ue,"A",{href:!0,rel:!0});var et=s(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=a(e,"P",{});var tt=s(P);Ue=l(tt,"The abstract from the paper is:"),tt.forEach(o),ae=u(e),z=a(e,"P",{});var ot=s(z);$=a(ot,"EM",{});var pe=s($);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=a(pe,"A",{href:!0,rel:!0});var nt=s(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),se=u(e),_=a(e,"H2",{class:!0});var me=s(_);k=a(me,"A",{id:!0,class:!0,href:!0});var at=s(k);Q=a(at,"SPAN",{});var st=s(Q);G(x.$$.fragment,st),st.forEach(o),at.forEach(o),xe=u(me),X=a(me,"SPAN",{});var rt=s(X);Ee=l(rt,"UNet1DModel"),rt.forEach(o),me.forEach(o),re=u(e),m=a(e,"DIV",{class:!0});var N=s(m);G(E.$$.fragment,N),qe=u(N),Y=a(N,"P",{});var it=s(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=a(N,"P",{});var fe=s(q);Be=l(fe,"This model inherits from "),F=a(fe,"A",{href:!0});var lt=s(F);Ie=l(lt,"ModelMixin"),lt.forEach(o),Oe=l(fe,`. Check the superclass documentation for it\u2019s generic methods implemented
for all models (such as downloading or saving).`),fe.forEach(o),Pe=u(N),D=a(N,"DIV",{class:!0});var he=s(D);G(A.$$.fragment,he),ze=u(he),S=a(he,"P",{});var _e=s(S);Fe=l(_e,"The "),C=a(_e,"A",{href:!0});var dt=s(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=a(e,"H2",{class:!0});var ge=s(g);y=a(ge,"A",{id:!0,class:!0,href:!0});var ct=s(y);Z=a(ct,"SPAN",{});var ut=s(Z);G(B.$$.fragment,ut),ut.forEach(o),ct.forEach(o),We=u(ge),ee=a(ge,"SPAN",{});var pt=s(ee);Ge=l(pt,"UNet1DOutput"),pt.forEach(o),ge.forEach(o),le=u(e),b=a(e,"DIV",{class:!0});var be=s(b);G(I.$$.fragment,be),He=u(be),O=a(be,"P",{});var ve=s(O);Re=l(ve,"The output of "),L=a(ve,"A",{href:!0});var mt=s(L);Ve=l(mt,"UNet1DModel"),mt.forEach(o),Je=l(ve,"."),ve.forEach(o),be.forEach(o),this.h()},h(){r(f,"name","hf:doc:metadata"),r(f,"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/main/en/api/models/overview#diffusers.ModelMixin"),r(C,"href","/docs/diffusers/main/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(m,"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/main/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,f),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,ae,d),p(e,z,d),t(z,$),t($,Me),t($,T),t(T,$e),t($,Te),p(e,se,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,m,d),H(E,m,null),t(m,qe),t(m,Y),t(Y,Ae),t(m,Se),t(m,q),t(q,Be),t(q,F),t(F,Ie),t(q,Oe),t(m,Pe),t(m,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(f),e&&o(te),e&&o(h),J(U),e&&o(oe),e&&o(w),e&&o(ne),e&&o(P),e&&o(ae),e&&o(z),e&&o(se),e&&o(_),J(x),e&&o(re),e&&o(m),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 ft{constructor(f){super();ht(this,f,Dt,wt,_t,{})}}export{Mt as default,kt as metadata};
