import{s as _e,n as ge,o as be}from"../chunks/scheduler.53228c21.js";import{S as De,i as ke,e as i,s,c as f,h as Ne,a as l,d as o,b as a,f as S,g as h,j as O,k as I,l as d,m as n,n as _,t as g,o as b,p as D}from"../chunks/index.100fac89.js";import{C as ye}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{D as re}from"../chunks/Docstring.db856a1e.js";import{H as ie,E as Ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function $e(le){let m,E,P,F,k,A,N,V,y,de='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.',W,U,me="The abstract from the paper is:",G,$,ce='<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>',R,v,j,r,w,te,B,ue="A 1D UNet model that takes a noisy sample and a timestep and returns a sample shaped output.",oe,C,pe=`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).`,ne,u,x,se,L,fe='The <a href="/docs/diffusers/main/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a> forward method.',J,M,K,c,T,ae,z,he='The output of <a href="/docs/diffusers/main/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a>.',Q,q,X,H,Y;return k=new ye({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),N=new ie({props:{title:"UNet1DModel",local:"unet1dmodel",headingTag:"h1"}}),v=new ie({props:{title:"UNet1DModel",local:"diffusers.UNet1DModel",headingTag:"h2"}}),w=new re({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:"time_embedding_dim",val:": typing.Optional[int] = None"},{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"}}),x=new re({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#L206",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>
`}}),M=new ie({props:{title:"UNet1DOutput",local:"diffusers.models.unets.unet_1d.UNet1DOutput",headingTag:"h2"}}),T=new re({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#L29"}}),q=new Ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/unet.md"}}),{c(){m=i("meta"),E=s(),P=i("p"),F=s(),f(k.$$.fragment),A=s(),f(N.$$.fragment),V=s(),y=i("p"),y.innerHTML=de,W=s(),U=i("p"),U.textContent=me,G=s(),$=i("p"),$.innerHTML=ce,R=s(),f(v.$$.fragment),j=s(),r=i("div"),f(w.$$.fragment),te=s(),B=i("p"),B.textContent=ue,oe=s(),C=i("p"),C.innerHTML=pe,ne=s(),u=i("div"),f(x.$$.fragment),se=s(),L=i("p"),L.innerHTML=fe,J=s(),f(M.$$.fragment),K=s(),c=i("div"),f(T.$$.fragment),ae=s(),z=i("p"),z.innerHTML=he,Q=s(),f(q.$$.fragment),X=s(),H=i("p"),this.h()},l(e){const t=Ne("svelte-u9bgzb",document.head);m=l(t,"META",{name:!0,content:!0}),t.forEach(o),E=a(e),P=l(e,"P",{}),S(P).forEach(o),F=a(e),h(k.$$.fragment,e),A=a(e),h(N.$$.fragment,e),V=a(e),y=l(e,"P",{"data-svelte-h":!0}),O(y)!=="svelte-1md5hd4"&&(y.innerHTML=de),W=a(e),U=l(e,"P",{"data-svelte-h":!0}),O(U)!=="svelte-1cwsb16"&&(U.textContent=me),G=a(e),$=l(e,"P",{"data-svelte-h":!0}),O($)!=="svelte-12epiox"&&($.innerHTML=ce),R=a(e),h(v.$$.fragment,e),j=a(e),r=l(e,"DIV",{class:!0});var p=S(r);h(w.$$.fragment,p),te=a(p),B=l(p,"P",{"data-svelte-h":!0}),O(B)!=="svelte-1afci55"&&(B.textContent=ue),oe=a(p),C=l(p,"P",{"data-svelte-h":!0}),O(C)!=="svelte-1hyu2ru"&&(C.innerHTML=pe),ne=a(p),u=l(p,"DIV",{class:!0});var Z=S(u);h(x.$$.fragment,Z),se=a(Z),L=l(Z,"P",{"data-svelte-h":!0}),O(L)!=="svelte-1nx8e33"&&(L.innerHTML=fe),Z.forEach(o),p.forEach(o),J=a(e),h(M.$$.fragment,e),K=a(e),c=l(e,"DIV",{class:!0});var ee=S(c);h(T.$$.fragment,ee),ae=a(ee),z=l(ee,"P",{"data-svelte-h":!0}),O(z)!=="svelte-dgf5oz"&&(z.innerHTML=he),ee.forEach(o),Q=a(e),h(q.$$.fragment,e),X=a(e),H=l(e,"P",{}),S(H).forEach(o),this.h()},h(){I(m,"name","hf:doc:metadata"),I(m,"content",ve),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"),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(c,"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,m),n(e,E,t),n(e,P,t),n(e,F,t),_(k,e,t),n(e,A,t),_(N,e,t),n(e,V,t),n(e,y,t),n(e,W,t),n(e,U,t),n(e,G,t),n(e,$,t),n(e,R,t),_(v,e,t),n(e,j,t),n(e,r,t),_(w,r,null),d(r,te),d(r,B),d(r,oe),d(r,C),d(r,ne),d(r,u),_(x,u,null),d(u,se),d(u,L),n(e,J,t),_(M,e,t),n(e,K,t),n(e,c,t),_(T,c,null),d(c,ae),d(c,z),n(e,Q,t),_(q,e,t),n(e,X,t),n(e,H,t),Y=!0},p:ge,i(e){Y||(g(k.$$.fragment,e),g(N.$$.fragment,e),g(v.$$.fragment,e),g(w.$$.fragment,e),g(x.$$.fragment,e),g(M.$$.fragment,e),g(T.$$.fragment,e),g(q.$$.fragment,e),Y=!0)},o(e){b(k.$$.fragment,e),b(N.$$.fragment,e),b(v.$$.fragment,e),b(w.$$.fragment,e),b(x.$$.fragment,e),b(M.$$.fragment,e),b(T.$$.fragment,e),b(q.$$.fragment,e),Y=!1},d(e){e&&(o(E),o(P),o(F),o(A),o(V),o(y),o(W),o(U),o(G),o($),o(R),o(j),o(r),o(J),o(K),o(c),o(Q),o(X),o(H)),o(m),D(k,e),D(N,e),D(v,e),D(w),D(x),D(M,e),D(T),D(q,e)}}}const ve='{"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 we(le){return be(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Be extends De{constructor(m){super(),ke(this,m,we,$e,_e,{})}}export{Be as component};
