import{S as jr,i as vr,s as Zr,e as s,k as p,w as h,t as o,M as _r,c as a,d as t,m as c,a as n,x as m,h as r,b as i,N as yi,G as l,g as f,y as d,L as Er,q as M,o as y,B as b,v as Ir}from"../../chunks/vendor-hf-doc-builder.js";import{I as S}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as me}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as Gr}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function Wr(bi){let N,Xt,Q,K,Kl,de,Rs,Ol,Ss,Vt,Me,Rt,Ke,et,ye,Ns,be,Qs,Ds,St,D,lt,Ys,xs,tt,As,Fs,Nt,O,st,J,Oe,zs,$s,el,qs,Hs,ll,Ps,Ls,tl,Ks,Os,sl,ea,la,g,w,al,ta,sa,nl,aa,na,il,ol,ia,oa,rl,ge,pl,gi,ra,cl,Je,pa,ca,T,ul,ua,fa,ee,ha,we,ma,da,Ma,fl,hl,ya,ba,ml,ga,Ja,dl,Te,wa,Ta,U,Ml,Ua,ja,yl,va,Za,bl,gl,_a,Ea,Jl,Ia,Ga,wl,Ue,Wa,Ba,j,Tl,ka,Ca,_,at,Xa,Va,je,Ra,Sa,ve,Na,Qa,Ze,Da,Ya,Ul,jl,xa,Aa,vl,Fa,za,Zl,_e,$a,qa,v,_l,Ha,Pa,Ee,nt,La,Ka,Oa,El,Il,en,ln,Gl,tn,sn,Wl,Ie,an,nn,Z,Bl,on,rn,kl,pn,cn,Cl,Xl,un,fn,Vl,hn,mn,Rl,Ge,dn,Qt,E,Mn,it,yn,bn,ot,gn,Jn,rt,wn,Tn,Dt,We,Yt,Y,le,pt,Be,Un,ct,jn,xt,x,te,ut,ke,vn,ft,Zn,At,Sl,_n,Ft,Nl,En,zt,Ce,$t,se,In,ht,Gn,Wn,qt,Xe,Ql,Ji,Bn,Ht,A,ae,mt,Ve,kn,dt,Cn,Pt,Dl,Xn,Lt,Re,Kt,F,Mt,Vn,Rn,Se,Sn,Nn,Ot,z,ne,yt,Ne,Qn,bt,Dn,es,Yl,Yn,ls,Qe,ts,G,xn,gt,An,Fn,Jt,zn,$n,ss,xl,wt,De,qn,Ye,Hn,Pn,as,$,ie,Tt,xe,Ln,Ut,Kn,ns,Al,On,is,Ae,os,Fl,ei,rs,q,oe,jt,Fe,li,vt,ti,ps,zl,si,cs,H,re,Zt,ze,ai,_t,ni,us,$e,fs,P,pe,Et,qe,ii,It,oi,hs,He,ms,ce,ri,Gt,pi,ci,ds,L,ue,Wt,Pe,ui,Bt,fi,Ms,$l,hi,ys,Le,bs,ql,mi,gs,Hl,Pl,wi,Js;return de=new S({}),Me=new Gr({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/custom_pipeline_examples.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/custom_pipeline_examples.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/custom_pipeline_examples.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/custom_pipeline_examples.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/custom_pipeline_examples.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/custom_pipeline_examples.ipynb"}]}}),We=new me({props:{code:"cGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS00JTIyJTJDJTIwY3VzdG9tX3BpcGVsaW5lJTNEJTIyZmlsZW5hbWVfaW5fdGhlX2NvbW11bml0eV9mb2xkZXIlMjIlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKQ==",highlighted:`pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>, custom_pipeline=<span class="hljs-string">&quot;filename_in_the_community_folder&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
)`}}),Be=new S({}),ke=new S({}),Ce=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBJbWFnZVByb2Nlc3NvciUyQyUyMENMSVBNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBJTBBZmVhdHVyZV9leHRyYWN0b3IlMjAlM0QlMjBDTElQSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmxhaW9uJTJGQ0xJUC1WaVQtQi0zMi1sYWlvbjJCLXMzNEItYjc5SyUyMiklMEFjbGlwX21vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJsYWlvbiUyRkNMSVAtVmlULUItMzItbGFpb24yQi1zMzRCLWI3OUslMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBJTBBJTBBZ3VpZGVkX3BpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMkMlMEElMjAlMjAlMjAlMjBjdXN0b21fcGlwZWxpbmUlM0QlMjJjbGlwX2d1aWRlZF9zdGFibGVfZGlmZnVzaW9uJTIyJTJDJTBBJTIwJTIwJTIwJTIwY2xpcF9tb2RlbCUzRGNsaXBfbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBmZWF0dXJlX2V4dH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GVsaW5lKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENy41JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwY2xpcF9ndWlkYW5jZV9zY2FsZSUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9jdXRvdXRzJTNENCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHVzZV9jdXRvdXRzJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEElMjAlMjAlMjAlMjApLmltYWdlcyU1QjAlNUQlMEElMjAlMjAlMjAlMjBpbWFnZXMuYXBwZW5kKGltYWdlKSUwQSUwQSUyMyUyMHNhdmUlMjBpbWFnZXMlMjBsb2NhbGx5JTBBZm9yJTIwaSUyQyUyMGltZyUyMGluJTIwZW51bWVyYXRlKGltYWdlcyklM0ElMEElMjAlMjAlMjAlMjBpbWcuc2F2ZShmJTIyLiUyRmNsaXBfZ3VpZGVkX3NkJTJGaW1hZ2VfJTdCaSU3RC5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPImageProcessor, CLIPModel
<span class="hljs-keyword">import</span> torch


feature_extractor = CLIPImageProcessor.from_pretrained(<span class="hljs-string">&quot;laion/CLIP-ViT-B-32-laion2B-s34B-b79K&quot;</span>)
clip_model = CLIPModel.from_pretrained(<span class="hljs-string">&quot;laion/CLIP-ViT-B-32-laion2B-s34B-b79K&quot;</span>, torch_dtype=torch.float16)


guided_pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>,
    custom_pipeline=<span class="hljs-string">&quot;clip_guided_stable_diffusion&quot;</span>,
    clip_model=clip_model,
    feature_extractor=feature_extractor,
    torch_dtype=torch.float16,
    use_safetensors=<span class="hljs-literal">True</span>,
)
guided_pipeline.enable_attention_slicing()
guided_pipeline = guided_pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;fantasy book cover, full moon, fantasy forest landscape, golden vector elements, fantasy magic, dark light night, intricate, elegant, sharp focus, illustration, highly detailed, digital painting, concept art, matte, art by WLOP and Artgerm and Albert Bierstadt, masterpiece&quot;</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
images = []
<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">4</span>):
    image = guided_pipeline(
        prompt,
        num_inference_steps=<span class="hljs-number">50</span>,
        guidance_scale=<span class="hljs-number">7.5</span>,
        clip_guidance_scale=<span class="hljs-number">100</span>,
        num_cutouts=<span class="hljs-number">4</span>,
        use_cutouts=<span class="hljs-literal">False</span>,
        generator=generator,
    ).images[<span class="hljs-number">0</span>]
    images.append(image)

<span class="hljs-comment"># save images locally</span>
<span class="hljs-keyword">for</span> i, img <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(images):
    img.save(<span class="hljs-string">f&quot;./clip_guided_sd/image_<span class="hljs-subst">{i}</span>.png&quot;</span>)`}}),Ve=new S({}),Re=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZkZHBtLWNpZmFyMTAtMzIlMjIlMkMlMjBjdXN0b21fcGlwZWxpbmUlM0QlMjJvbmVfc3RlcF91bmV0JTIyKSUwQXBpcGUoKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>, custom_pipeline=<span class="hljs-string">&quot;one_step_unet&quot;</span>)
pipe()`}}),Ne=new S({}),Qe=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEElMjAlMjAlMjAlMjBzYWZldHlfY2hlY2tlciUzRE5vbmUlMkMlMjAlMjAlMjMlMjBWZXJ5JTIwaW1wb3J0YW50JTIwZm9yJTIwdmlkZW9zLi4ubG90cyUyMG9mJTIwZmFsc2UlMjBwb3NpdGl2ZXMlMjB3aGlsZSUyMGludGVycG9sYXRpbmclMEElMjAlMjAlMjAlMjBjdXN0b21fcGlwZWxpbmUlM0QlMjJpbnRlcnBvbGF0ZV9zdGFibGVfZGlmZnVzaW9uJTIyJTJDJTBBJTIwJTIwJTIwJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUwQSkudG8oJTIyY3VkYSUyMiklMEFwaXBlLmVuYWJsZV9hdHRlbnRpb25fc2xpY2luZygpJTBBJTBBZnJhbWVfZmlsZXBhdGhzJTIwJTNEJTIwcGlwZS53YWxrKCUwQSUyMCUyMCUyMCUyMHByb21wdHMlM0QlNUIlMjJhJTIwZG9nJTIyJTJDJTIwJTIyYSUyMGNhdCUyMiUyQyUyMCUyMmElMjBob3JzZSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNlZWRzJTNEJTVCNDIlMkMlMjAxMzM3JTJDJTIwMTIzNCU1RCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbnRlcnBvbGF0aW9uX3N0ZXBzJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIyLiUyRmRyZWFtcyUyMiUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENTEyJTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q1MTIlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDguNSUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>,
    torch_dtype=torch.float16,
    safety_checker=<span class="hljs-literal">None</span>,  <span class="hljs-comment"># Very important for videos...lots of false positives while interpolating</span>
    custom_pipeline=<span class="hljs-string">&quot;interpolate_stable_diffusion&quot;</span>,
    use_safetensors=<span class="hljs-literal">True</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipe.enable_attention_slicing()

frame_filepaths = pipe.walk(
    prompts=[<span class="hljs-string">&quot;a dog&quot;</span>, <span class="hljs-string">&quot;a cat&quot;</span>, <span class="hljs-string">&quot;a horse&quot;</span>],
    seeds=[<span class="hljs-number">42</span>, <span class="hljs-number">1337</span>, <span class="hljs-number">1234</span>],
    num_interpolation_steps=<span class="hljs-number">16</span>,
    output_dir=<span class="hljs-string">&quot;./dreams&quot;</span>,
    batch_size=<span class="hljs-number">4</span>,
    height=<span class="hljs-number">512</span>,
    width=<span class="hljs-number">512</span>,
    guidance_scale=<span class="hljs-number">8.5</span>,
    num_inference_steps=<span class="hljs-number">50</span>,
)`}}),xe=new S({}),Ae=new me({props:{code:"JTIzISUyRnVzciUyRmJpbiUyRmVudiUyMHB5dGhvbjMlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFpbXBvcnQlMjBQSUwlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUwQWRlZiUyMGRvd25sb2FkX2ltYWdlKHVybCklM0ElMEElMjAlMjAlMjAlMjByZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwUElMLkltYWdlLm9wZW4oQnl0ZXNJTyhyZXNwb25zZS5jb250ZW50KSkuY29udmVydCglMjJSR0IlMjIpJTBBJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS00JTIyJTJDJTBBJTIwJTIwJTIwJTIwY3VzdG9tX3BpcGVsaW5lJTNEJTIyc3RhYmxlX2RpZmZ1c2lvbl9tZWdhJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUwQSklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBcGlwZS5lbmFibGVfYXR0ZW50aW9uX3NsaWNpbmcoKSUwQSUwQSUwQSUyMyUyMyUyMyUyMFRleHQtdG8tSW1hZ2UlMEElMEFpbWFnZXMl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WZmdXNpb24lMkZtYWluJTJGZGF0YSUyRmlucGFpbnRpbmdfZXhhbXBsZXMlMkZvdmVydHVyZS1jcmVhdGlvbnMtNXNJNmZRZ1lJdW9fbWFzay5wbmclMjIlMEFpbml0X2ltYWdlJTIwJTNEJTIwZG93bmxvYWRfaW1hZ2UoaW1nX3VybCkucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUwQW1hc2tfaW1hZ2UlMjAlM0QlMjBkb3dubG9hZF9pbWFnZShtYXNrX3VybCkucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjBjYXQlMjBzaXR0aW5nJTIwb24lMjBhJTIwYmVuY2glMjIlMEFpbWFnZXMlMjAlM0QlMjBwaXBlLmlucGFpbnQocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2tfaW1hZ2UlMkMlMjBzdHJlbmd0aCUzRDAuNzUpLmltYWdlcw==",highlighted:`<span class="hljs-comment">#!/usr/bin/env python3</span>
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> PIL
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">import</span> torch


<span class="hljs-keyword">def</span> <span class="hljs-title function_">download_image</span>(<span class="hljs-params">url</span>):
    response = requests.get(url)
    <span class="hljs-keyword">return</span> PIL.Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)


pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>,
    custom_pipeline=<span class="hljs-string">&quot;stable_diffusion_mega&quot;</span>,
    torch_dtype=torch.float16,
    use_safetensors=<span class="hljs-literal">True</span>,
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipe.enable_attention_slicing()


<span class="hljs-comment">### Text-to-Image</span>

images = pipe.text2img(<span class="hljs-string">&quot;An astronaut riding a horse&quot;</span>).images

<span class="hljs-comment">### Image-to-Image</span>

init_image = download_image(
    <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
)

prompt = <span class="hljs-string">&quot;A fantasy landscape, trending on artstation&quot;</span>

images = pipe.img2img(prompt=prompt, image=init_image, strength=<span class="hljs-number">0.75</span>, guidance_scale=<span class="hljs-number">7.5</span>).images

<span class="hljs-comment">### Inpainting</span>

img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>
init_image = download_image(img_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))
mask_image = download_image(mask_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))

prompt = <span class="hljs-string">&quot;a cat sitting on a bench&quot;</span>
images = pipe.inpaint(prompt=prompt, image=init_image, mask_image=mask_image, strength=<span class="hljs-number">0.75</span>).images`}}),Fe=new S({}),ze=new S({}),$e=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmhha3VyZWklMkZ3YWlmdS1kaWZmdXNpb24lMjIlMkMlMjBjdXN0b21fcGlwZWxpbmUlM0QlMjJscHdfc3RhYmxlX2RpZmZ1c2lvbiUyMiUyQyUyMHRvcmNoX2R0eXBlJ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aWdpdHMlMkMlMjBjcm9wcGVkJTJDJTIwd29yc3RfcXVhbGl0eSUyQyUyMGxvd19xdWFsaXR5JTJDJTIwbm9ybWFsX3F1YWxpdHklMkMlMjBqcGVnX2FydGlmYWN0cyUyQyUyMHNpZ25hdHVyZSUyQyUyMHdhdGVybWFyayUyQyUyMHVzZXJuYW1lJTJDJTIwYmx1cnJ5JTIyJTBBJTBBcGlwZS50ZXh0MmltZyhwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdfcHJvbXB0JTJDJTIwd2lkdGglM0Q1MTIlMkMlMjBoZWlnaHQlM0Q1MTIlMkMlMjBtYXhfZW1iZWRkaW5nc19tdWx0aXBsZXMlM0QzKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;hakurei/waifu-diffusion&quot;</span>, custom_pipeline=<span class="hljs-string">&quot;lpw_stable_diffusion&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;best_quality (1girl:1.3) bow bride brown_hair closed_mouth frilled_bow frilled_hair_tubes frills (full_body:1.3) fox_ear hair_bow hair_tubes happy hood japanese_clothes kimono long_sleeves red_bow smile solo tabi uchikake white_kimono wide_sleeves cherry_blossoms&quot;</span>
neg_prompt = <span class="hljs-string">&quot;lowres, bad_anatomy, error_body, error_hair, error_arm, error_hands, bad_hands, error_fingers, bad_fingers, missing_fingers, error_legs, bad_legs, multiple_legs, missing_legs, error_lighting, error_shadow, error_reflection, text, error, extra_digit, fewer_digits, cropped, worst_quality, low_quality, normal_quality, jpeg_artifacts, signature, watermark, username, blurry&quot;</span>

pipe.text2img(prompt, negative_prompt=neg_prompt, width=<span class="hljs-number">512</span>, height=<span class="hljs-number">512</span>, max_embeddings_multiples=<span class="hljs-number">3</span>).images[<span class="hljs-number">0</span>]`}}),qe=new S({}),He=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMkMlMEElMjAlMjAlMjAlMjBjdXN0b21fcGlwZWxpbmUlM0QlMjJscHdfc3RhYmxlX2RpZmZ1c2lvbl9vbm54JTIyJTJDJTBBJTIwJTIwJTIwJTIwcmV2aXNpb24lM0QlMjJvbm54JTIyJTJDJTBBJTIwJTIwJTIwJTIwcHJvdmlkZXIlM0QlMjJDVURBRXhlY3V0aW9uUHJvdmlkZXIlMjIlMkMlMEElMjAlMjAlMjAlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTBBKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjBwaG90byUyMG9mJTIwYW4lMjBhc3Ryb25hdXQlMjByaWRpbmclMjBhJTIwaG9yc2UlMjBvbiUyMG1hcnMlMkMlMjBiZXN0JTIwcXVhbGl0eSUyMiUwQW5lZ19wcm9tcHQlMjAlM0QlMjAlMjJsb3dyZXMlMkMlMjBiYWQlMjBhbmF0b215JTJDJTIwZXJyb3IlMjBib2R5JTJDJTIwZXJyb3IlMjBoYWlyJTJDJTIwZXJyb3IlMjBhcm0lMkMlMjBlcnJvciUyMGhhbmRzJTJDJTIwYmFkJTIwaGFuZHMlMkMlMjBlcnJvciUyMGZpbmdlcnMlMkMlMjBiYWQlMjBmaW5nZXJzJTJDJTIwbWlzc2luZyUyMGZpbmdlcnMlMkMlMjBlcnJvciUyMGxlZ3MlMkMlMjBiYWQlMjBsZWdzJTJDJTIwbXVsdGlwbGUlMjBsZWdzJTJDJTIwbWlzc2luZyUyMGxlZ3MlMkMlMjBlcnJvciUyMGxpZ2h0aW5nJTJDJTIwZXJyb3IlMjBzaGFkb3clMkMlMjBlcnJvciUyMHJlZmxlY3Rpb24lMkMlMjB0ZXh0JTJDJTIwZXJyb3IlMkMlMjBleHRyYSUyMGRpZ2l0JTJDJTIwZmV3ZXIlMjBkaWdpdHMlMkMlMjBjcm9wcGVkJTJDJTIwd29yc3QlMjBxdWFsaXR5JTJDJTIwbG93JTIwcXVhbGl0eSUyQyUyMG5vcm1hbCUyMHF1YWxpdHklMkMlMjBqcGVnJTIwYXJ0aWZhY3RzJTJDJTIwc2lnbmF0dXJlJTJDJTIwd2F0ZXJtYXJrJTJDJTIwdXNlcm5hbWUlMkMlMjBibHVycnklMjIlMEElMEFwaXBlLnRleHQyaW1nKHByb21wdCUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ19wcm9tcHQlMkMlMjB3aWR0aCUzRDUxMiUyQyUyMGhlaWdodCUzRDUxMiUyQyUyMG1heF9lbWJlZGRpbmdzX211bHRpcGxlcyUzRDMpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>,
    custom_pipeline=<span class="hljs-string">&quot;lpw_stable_diffusion_onnx&quot;</span>,
    revision=<span class="hljs-string">&quot;onnx&quot;</span>,
    provider=<span class="hljs-string">&quot;CUDAExecutionProvider&quot;</span>,
    use_safetensors=<span class="hljs-literal">True</span>,
)

prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars, best quality&quot;</span>
neg_prompt = <span class="hljs-string">&quot;lowres, bad anatomy, error body, error hair, error arm, error hands, bad hands, error fingers, bad fingers, missing fingers, error legs, bad legs, multiple legs, missing legs, error lighting, error shadow, error reflection, text, error, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry&quot;</span>

pipe.text2img(prompt, negative_prompt=neg_prompt, width=<span class="hljs-number">512</span>, height=<span class="hljs-number">512</span>, max_embeddings_multiples=<span class="hljs-number">3</span>).images[<span class="hljs-number">0</span>]`}}),Pe=new S({}),Le=new me({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFpbXBvcnQlMjBtYXRwbG90bGliLnB5cGxvdCUyMGFzJTIwcGx0JTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBXaGlzcGVyRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTJDJTBBJTIwJTIwJTIwJTIwV2hpc3BlclByb2Nlc3NvciUyQyUwQSklMEElMEElMEFkZXZpY2UlMjAlM0QlMjAlMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiUwQSUwQWRzJTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZsaWJyaXNwZWVjaF9hc3JfZHVtbXklMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiUyMiklMEElMEFhdWRpb19zYW1wbGUlMjAlM0QlMjBkcyU1QjMlNUQlMEElMEF0ZXh0JTIwJTNEJTIwYXVkaW9fc2FtcGxlJTVCJTIydGV4dCUyMiU1RC5sb3dlcigpJTBBc3BlZWNoX2RhdGElMjAlM0QlMjBhdWRpb19zYW1wbGUlNUIlMjJhdWRpbyUyMiU1RCU1QiUyMmFycmF5JTIyJTVEJTBBJTBBbW9kZWwlMjAlM0QlMjBXaGlzcGVyRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJvcGVuYWklMkZ3aGlzcGVyLXNtYWxsJTIyKS50byhkZXZpY2UpJTBBcHJvY2Vzc29yJTIwJTNEJTIwV2hpc3BlclByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGd2hpc3Blci1zbWFsbCUyMiklMEElMEFkaWZmdXNlcl9waXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS00JTIyJTJDJTBBJTIwJTIwJTIwJTIwY3VzdG9tX3BpcGVsaW5lJTNEJTIyc3BlZWNoX3RvX2ltYWdlX2RpZmZ1c2lvbiUyMiUyQyUwQSUyMCUyMCUyMCUyMHNwZWVjaF9tb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwc3BlZWNoX3Byb2Nlc3NvciUzRHByb2Nlc3NvciUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMkMlMEEpJTBBJTBBZGlmZnVzZXJfcGlwZWxpbmUuZW5hYmxlX2F0dGVudGlvbl9zbGljaW5nKCklMEFkaWZmdXNlcl9waXBlbGluZSUyMCUzRCUyMGRpZmZ1c2VyX3BpcGVsaW5lLnRvKGRldmljZSklMEElMEFvdXRwdXQlMjAlM0QlMjBkaWZmdXNlcl9waXBlbGluZShzcGVlY2hfZGF0YSklMEFwbHQuaW1zaG93KG91dHB1dC5pbWFnZXMlNUIwJTVEKQ==",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">import</span> matplotlib.pyplot <span class="hljs-keyword">as</span> plt
<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    WhisperForConditionalGeneration,
    WhisperProcessor,
)


device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

ds = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_dummy&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation&quot;</span>)

audio_sample = ds[<span class="hljs-number">3</span>]

text = audio_sample[<span class="hljs-string">&quot;text&quot;</span>].lower()
speech_data = audio_sample[<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>]

model = WhisperForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;openai/whisper-small&quot;</span>).to(device)
processor = WhisperProcessor.from_pretrained(<span class="hljs-string">&quot;openai/whisper-small&quot;</span>)

diffuser_pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>,
    custom_pipeline=<span class="hljs-string">&quot;speech_to_image_diffusion&quot;</span>,
    speech_model=model,
    speech_processor=processor,
    torch_dtype=torch.float16,
    use_safetensors=<span class="hljs-literal">True</span>,
)

diffuser_pipeline.enable_attention_slicing()
diffuser_pipeline = diffuser_pipeline.to(device)

output = diffuser_pipeline(speech_data)
plt.imshow(output.images[<span class="hljs-number">0</span>])`}}),{c(){N=s("meta"),Xt=p(),Q=s("h1"),K=s("a"),Kl=s("span"),h(de.$$.fragment),Rs=p(),Ol=s("span"),Ss=o("Community pipelines"),Vt=p(),h(Me.$$.fragment),Rt=p(),Ke=s("blockquote"),et=s("p"),ye=s("strong"),Ns=o("For more information about community pipelines, please have a look at "),be=s("a"),Qs=o("this issue"),Ds=o("."),St=p(),D=s("p"),lt=s("strong"),Ys=o("Community"),xs=o(` examples consist of both inference and training examples that have been added by the community.
Please have a look at the following table to get an overview of all community examples. Click on the `),tt=s("strong"),As=o("Code Example"),Fs=o(` to get a copy-and-paste ready code example that you can try out.
If a community doesn\u2019t work as expected, please open an issue and ping the author on it.`),Nt=p(),O=s("table"),st=s("thead"),J=s("tr"),Oe=s("th"),zs=o("Example"),$s=p(),el=s("th"),qs=o("Description"),Hs=p(),ll=s("th"),Ps=o("Code Example"),Ls=p(),tl=s("th"),Ks=o("Colab"),Os=p(),sl=s("th"),ea=o("Author"),la=p(),g=s("tbody"),w=s("tr"),al=s("td"),ta=o("CLIP Guided Stable Diffusion"),sa=p(),nl=s("td"),aa=o("Doing CLIP guidance for text to image generation with Stable Diffusion"),na=p(),il=s("td"),ol=s("a"),ia=o("CLIP Guided Stable Diffusion"),oa=p(),rl=s("td"),ge=s("a"),pl=s("img"),ra=p(),cl=s("td"),Je=s("a"),pa=o("Suraj Patil"),ca=p(),T=s("tr"),ul=s("td"),ua=o("One Step U-Net (Dummy)"),fa=p(),ee=s("td"),ha=o("Example showcasing of how to use Community Pipelines (see "),we=s("a"),ma=o("https://github.com/huggingface/diffusers/issues/841"),da=o(")"),Ma=p(),fl=s("td"),hl=s("a"),ya=o("One Step U-Net"),ba=p(),ml=s("td"),ga=o("-"),Ja=p(),dl=s("td"),Te=s("a"),wa=o("Patrick von Platen"),Ta=p(),U=s("tr"),Ml=s("td"),Ua=o("Stable Diffusion Interpolation"),ja=p(),yl=s("td"),va=o("Interpolate the latent space of Stable Diffusion between different prompts/seeds"),Za=p(),bl=s("td"),gl=s("a"),_a=o("Stable Diffusion Interpolation"),Ea=p(),Jl=s("td"),Ia=o("-"),Ga=p(),wl=s("td"),Ue=s("a"),Wa=o("Nate Raw"),Ba=p(),j=s("tr"),Tl=s("td"),ka=o("Stable Diffusion Mega"),Ca=p(),_=s("td"),at=s("strong"),Xa=o("One"),Va=o(" Stable Diffusion Pipeline with all functionalities of "),je=s("a"),Ra=o("Text2Image"),Sa=o(", "),ve=s("a"),Na=o("Image2Image"),Qa=o(" and "),Ze=s("a"),Da=o("Inpainting"),Ya=p(),Ul=s("td"),jl=s("a"),xa=o("Stable Diffusion Mega"),Aa=p(),vl=s("td"),Fa=o("-"),za=p(),Zl=s("td"),_e=s("a"),$a=o("Patrick von Platen"),qa=p(),v=s("tr"),_l=s("td"),Ha=o("Long Prompt Weighting Stable Diffusion"),Pa=p(),Ee=s("td"),nt=s("strong"),La=o("One"),Ka=o(" Stable Diffusion Pipeline without tokens length limit, and support parsing weighting in prompt."),Oa=p(),El=s("td"),Il=s("a"),en=o("Long Prompt Weighting Stable Diffusion"),ln=p(),Gl=s("td"),tn=o("-"),sn=p(),Wl=s("td"),Ie=s("a"),an=o("SkyTNT"),nn=p(),Z=s("tr"),Bl=s("td"),on=o("Speech to Image"),rn=p(),kl=s("td"),pn=o("Using automatic-speech-recognition to transcribe text and Stable Diffusion to generate images"),cn=p(),Cl=s("td"),Xl=s("a"),un=o("Speech to Image"),fn=p(),Vl=s("td"),hn=o("-"),mn=p(),Rl=s("td"),Ge=s("a"),dn=o("Mikail Duzenli"),Qt=p(),E=s("p"),Mn=o("To load a custom pipeline you just need to pass the "),it=s("code"),yn=o("custom_pipeline"),bn=o(" argument to "),ot=s("code"),gn=o("DiffusionPipeline"),Jn=o(", as one of the files in "),rt=s("code"),wn=o("diffusers/examples/community"),Tn=o(". Feel free to send a PR with your own pipelines, we will merge them quickly."),Dt=p(),h(We.$$.fragment),Yt=p(),Y=s("h2"),le=s("a"),pt=s("span"),h(Be.$$.fragment),Un=p(),ct=s("span"),jn=o("Example usages"),xt=p(),x=s("h3"),te=s("a"),ut=s("span"),h(ke.$$.fragment),vn=p(),ft=s("span"),Zn=o("CLIP Guided Stable Diffusion"),At=p(),Sl=s("p"),_n=o(`CLIP guided stable diffusion can help to generate more realistic images
by guiding stable diffusion at every denoising step with an additional CLIP model.`),Ft=p(),Nl=s("p"),En=o("The following code requires roughly 12GB of GPU RAM."),zt=p(),h(Ce.$$.fragment),$t=p(),se=s("p"),In=o("The "),ht=s("code"),Gn=o("images"),Wn=o(` list contains a list of PIL images that can be saved locally or displayed directly in a google colab.
Generated images tend to be of higher qualtiy than natively using stable diffusion. E.g. the above script generates the following images:`),qt=p(),Xe=s("p"),Ql=s("img"),Bn=o("."),Ht=p(),A=s("h3"),ae=s("a"),mt=s("span"),h(Ve.$$.fragment),kn=p(),dt=s("span"),Cn=o("One Step Unet"),Pt=p(),Dl=s("p"),Xn=o("The dummy \u201Cone-step-unet\u201D can be run as follows:"),Lt=p(),h(Re.$$.fragment),Kt=p(),F=s("p"),Mt=s("strong"),Vn=o("Note"),Rn=o(": This community pipeline is not useful as a feature, but rather just serves as an example of how community pipelines can be added (see "),Se=s("a"),Sn=o("https://github.com/huggingface/diffusers/issues/841"),Nn=o(")."),Ot=p(),z=s("h3"),ne=s("a"),yt=s("span"),h(Ne.$$.fragment),Qn=p(),bt=s("span"),Dn=o("Stable Diffusion Interpolation"),es=p(),Yl=s("p"),Yn=o("The following code can be run on a GPU of at least 8GB VRAM and should take approximately 5 minutes."),ls=p(),h(Qe.$$.fragment),ts=p(),G=s("p"),xn=o("The output of the "),gt=s("code"),An=o("walk(...)"),Fn=o(" function returns a list of images saved under the folder as defined in "),Jt=s("code"),zn=o("output_dir"),$n=o(". You can use these images to create videos of stable diffusion."),ss=p(),xl=s("blockquote"),wt=s("p"),De=s("strong"),qn=o("Please have a look at "),Ye=s("a"),Hn=o("https://github.com/nateraw/stable-diffusion-videos"),Pn=o(" for more in-detail information on how to create videos using stable diffusion as well as more feature-complete functionality."),as=p(),$=s("h3"),ie=s("a"),Tt=s("span"),h(xe.$$.fragment),Ln=p(),Ut=s("span"),Kn=o("Stable Diffusion Mega"),ns=p(),Al=s("p"),On=o("The Stable Diffusion Mega Pipeline lets you use the main use cases of the stable diffusion pipeline in a single class."),is=p(),h(Ae.$$.fragment),os=p(),Fl=s("p"),ei=o("As shown above this one pipeline can run all both \u201Ctext-to-image\u201D, \u201Cimage-to-image\u201D, and \u201Cinpainting\u201D in one pipeline."),rs=p(),q=s("h3"),oe=s("a"),jt=s("span"),h(Fe.$$.fragment),li=p(),vt=s("span"),ti=o("Long Prompt Weighting Stable Diffusion"),ps=p(),zl=s("p"),si=o(`The Pipeline lets you input prompt without 77 token length limit. And you can increase words weighting by using \u201D()\u201D or decrease words weighting by using \u201D[]\u201D
The Pipeline also lets you use the main use cases of the stable diffusion pipeline in a single class.`),cs=p(),H=s("h4"),re=s("a"),Zt=s("span"),h(ze.$$.fragment),ai=p(),_t=s("span"),ni=o("pytorch"),us=p(),h($e.$$.fragment),fs=p(),P=s("h4"),pe=s("a"),Et=s("span"),h(qe.$$.fragment),ii=p(),It=s("span"),oi=o("onnxruntime"),hs=p(),h(He.$$.fragment),ms=p(),ce=s("p"),ri=o("if you see "),Gt=s("code"),pi=o("Token indices sequence length is longer than the specified maximum sequence length for this model ( *** > 77 ) . Running this sequence through the model will result in indexing errors"),ci=o(". Do not worry, it is normal."),ds=p(),L=s("h3"),ue=s("a"),Wt=s("span"),h(Pe.$$.fragment),ui=p(),Bt=s("span"),fi=o("Speech to Image"),Ms=p(),$l=s("p"),hi=o("The following code can generate an image from an audio sample using pre-trained OpenAI whisper-small and Stable Diffusion."),ys=p(),h(Le.$$.fragment),bs=p(),ql=s("p"),mi=o("This example produces the following image:"),gs=p(),Hl=s("p"),Pl=s("img"),this.h()},l(e){const u=_r('[data-svelte="svelte-1phssyn"]',document.head);N=a(u,"META",{name:!0,content:!0}),u.forEach(t),Xt=c(e),Q=a(e,"H1",{class:!0});var ws=n(Q);K=a(ws,"A",{id:!0,class:!0,href:!0});var Ti=n(K);Kl=a(Ti,"SPAN",{});var Ui=n(Kl);m(de.$$.fragment,Ui),Ui.forEach(t),Ti.forEach(t),Rs=c(ws),Ol=a(ws,"SPAN",{});var ji=n(Ol);Ss=r(ji,"Community pipelines"),ji.forEach(t),ws.forEach(t),Vt=c(e),m(Me.$$.fragment,e),Rt=c(e),Ke=a(e,"BLOCKQUOTE",{});var vi=n(Ke);et=a(vi,"P",{});var Zi=n(et);ye=a(Zi,"STRONG",{});var Ts=n(ye);Ns=r(Ts,"For more information about community pipelines, please have a look at "),be=a(Ts,"A",{href:!0,rel:!0});var _i=n(be);Qs=r(_i,"this issue"),_i.forEach(t),Ds=r(Ts,"."),Ts.forEach(t),Zi.forEach(t),vi.forEach(t),St=c(e),D=a(e,"P",{});var kt=n(D);lt=a(kt,"STRONG",{});var Ei=n(lt);Ys=r(Ei,"Community"),Ei.forEach(t),xs=r(kt,` examples consist of both inference and training examples that have been added by the community.
Please have a look at the following table to get an overview of all community examples. Click on the `),tt=a(kt,"STRONG",{});var Ii=n(tt);As=r(Ii,"Code Example"),Ii.forEach(t),Fs=r(kt,` to get a copy-and-paste ready code example that you can try out.
If a community doesn\u2019t work as expected, please open an issue and ping the author on it.`),kt.forEach(t),Nt=c(e),O=a(e,"TABLE",{});var Us=n(O);st=a(Us,"THEAD",{});var Gi=n(st);J=a(Gi,"TR",{});var W=n(J);Oe=a(W,"TH",{align:!0});var Wi=n(Oe);zs=r(Wi,"Example"),Wi.forEach(t),$s=c(W),el=a(W,"TH",{align:!0});var Bi=n(el);qs=r(Bi,"Description"),Bi.forEach(t),Hs=c(W),ll=a(W,"TH",{align:!0});var ki=n(ll);Ps=r(ki,"Code Example"),ki.forEach(t),Ls=c(W),tl=a(W,"TH",{align:!0});var Ci=n(tl);Ks=r(Ci,"Colab"),Ci.forEach(t),Os=c(W),sl=a(W,"TH",{align:!0});var Xi=n(sl);ea=r(Xi,"Author"),Xi.forEach(t),W.forEach(t),Gi.forEach(t),la=c(Us),g=a(Us,"TBODY",{});var I=n(g);w=a(I,"TR",{});var B=n(w);al=a(B,"TD",{align:!0});var Vi=n(al);ta=r(Vi,"CLIP Guided Stable Diffusion"),Vi.forEach(t),sa=c(B),nl=a(B,"TD",{align:!0});var Ri=n(nl);aa=r(Ri,"Doing CLIP guidance for text to image generation with Stable Diffusion"),Ri.forEach(t),na=c(B),il=a(B,"TD",{align:!0});var Si=n(il);ol=a(Si,"A",{href:!0});var Ni=n(ol);ia=r(Ni,"CLIP Guided Stable Diffusion"),Ni.forEach(t),Si.forEach(t),oa=c(B),rl=a(B,"TD",{align:!0});var Qi=n(rl);ge=a(Qi,"A",{href:!0,rel:!0});var Di=n(ge);pl=a(Di,"IMG",{src:!0,alt:!0}),Di.forEach(t),Qi.forEach(t),ra=c(B),cl=a(B,"TD",{align:!0});var Yi=n(cl);Je=a(Yi,"A",{href:!0,rel:!0});var xi=n(Je);pa=r(xi,"Suraj Patil"),xi.forEach(t),Yi.forEach(t),B.forEach(t),ca=c(I),T=a(I,"TR",{});var k=n(T);ul=a(k,"TD",{align:!0});var Ai=n(ul);ua=r(Ai,"One Step U-Net (Dummy)"),Ai.forEach(t),fa=c(k),ee=a(k,"TD",{align:!0});var js=n(ee);ha=r(js,"Example showcasing of how to use Community Pipelines (see "),we=a(js,"A",{href:!0,rel:!0});var Fi=n(we);ma=r(Fi,"https://github.com/huggingface/diffusers/issues/841"),Fi.forEach(t),da=r(js,")"),js.forEach(t),Ma=c(k),fl=a(k,"TD",{align:!0});var zi=n(fl);hl=a(zi,"A",{href:!0});var $i=n(hl);ya=r($i,"One Step U-Net"),$i.forEach(t),zi.forEach(t),ba=c(k),ml=a(k,"TD",{align:!0});var qi=n(ml);ga=r(qi,"-"),qi.forEach(t),Ja=c(k),dl=a(k,"TD",{align:!0});var Hi=n(dl);Te=a(Hi,"A",{href:!0,rel:!0});var Pi=n(Te);wa=r(Pi,"Patrick von Platen"),Pi.forEach(t),Hi.forEach(t),k.forEach(t),Ta=c(I),U=a(I,"TR",{});var C=n(U);Ml=a(C,"TD",{align:!0});var Li=n(Ml);Ua=r(Li,"Stable Diffusion Interpolation"),Li.forEach(t),ja=c(C),yl=a(C,"TD",{align:!0});var Ki=n(yl);va=r(Ki,"Interpolate the latent space of Stable Diffusion between different prompts/seeds"),Ki.forEach(t),Za=c(C),bl=a(C,"TD",{align:!0});var Oi=n(bl);gl=a(Oi,"A",{href:!0});var eo=n(gl);_a=r(eo,"Stable Diffusion Interpolation"),eo.forEach(t),Oi.forEach(t),Ea=c(C),Jl=a(C,"TD",{align:!0});var lo=n(Jl);Ia=r(lo,"-"),lo.forEach(t),Ga=c(C),wl=a(C,"TD",{align:!0});var to=n(wl);Ue=a(to,"A",{href:!0,rel:!0});var so=n(Ue);Wa=r(so,"Nate Raw"),so.forEach(t),to.forEach(t),C.forEach(t),Ba=c(I),j=a(I,"TR",{});var X=n(j);Tl=a(X,"TD",{align:!0});var ao=n(Tl);ka=r(ao,"Stable Diffusion Mega"),ao.forEach(t),Ca=c(X),_=a(X,"TD",{align:!0});var fe=n(_);at=a(fe,"STRONG",{});var no=n(at);Xa=r(no,"One"),no.forEach(t),Va=r(fe," Stable Diffusion Pipeline with all functionalities of "),je=a(fe,"A",{href:!0,rel:!0});var io=n(je);Ra=r(io,"Text2Image"),io.forEach(t),Sa=r(fe,", "),ve=a(fe,"A",{href:!0,rel:!0});var oo=n(ve);Na=r(oo,"Image2Image"),oo.forEach(t),Qa=r(fe," and "),Ze=a(fe,"A",{href:!0,rel:!0});var ro=n(Ze);Da=r(ro,"Inpainting"),ro.forEach(t),fe.forEach(t),Ya=c(X),Ul=a(X,"TD",{align:!0});var po=n(Ul);jl=a(po,"A",{href:!0});var co=n(jl);xa=r(co,"Stable Diffusion Mega"),co.forEach(t),po.forEach(t),Aa=c(X),vl=a(X,"TD",{align:!0});var uo=n(vl);Fa=r(uo,"-"),uo.forEach(t),za=c(X),Zl=a(X,"TD",{align:!0});var fo=n(Zl);_e=a(fo,"A",{href:!0,rel:!0});var ho=n(_e);$a=r(ho,"Patrick von Platen"),ho.forEach(t),fo.forEach(t),X.forEach(t),qa=c(I),v=a(I,"TR",{});var V=n(v);_l=a(V,"TD",{align:!0});var mo=n(_l);Ha=r(mo,"Long Prompt Weighting Stable Diffusion"),mo.forEach(t),Pa=c(V),Ee=a(V,"TD",{align:!0});var di=n(Ee);nt=a(di,"STRONG",{});var Mo=n(nt);La=r(Mo,"One"),Mo.forEach(t),Ka=r(di," Stable Diffusion Pipeline without tokens length limit, and support parsing weighting in prompt."),di.forEach(t),Oa=c(V),El=a(V,"TD",{align:!0});var yo=n(El);Il=a(yo,"A",{href:!0});var bo=n(Il);en=r(bo,"Long Prompt Weighting Stable Diffusion"),bo.forEach(t),yo.forEach(t),ln=c(V),Gl=a(V,"TD",{align:!0});var go=n(Gl);tn=r(go,"-"),go.forEach(t),sn=c(V),Wl=a(V,"TD",{align:!0});var Jo=n(Wl);Ie=a(Jo,"A",{href:!0,rel:!0});var wo=n(Ie);an=r(wo,"SkyTNT"),wo.forEach(t),Jo.forEach(t),V.forEach(t),nn=c(I),Z=a(I,"TR",{});var R=n(Z);Bl=a(R,"TD",{align:!0});var To=n(Bl);on=r(To,"Speech to Image"),To.forEach(t),rn=c(R),kl=a(R,"TD",{align:!0});var Uo=n(kl);pn=r(Uo,"Using automatic-speech-recognition to transcribe text and Stable Diffusion to generate images"),Uo.forEach(t),cn=c(R),Cl=a(R,"TD",{align:!0});var jo=n(Cl);Xl=a(jo,"A",{href:!0});var vo=n(Xl);un=r(vo,"Speech to Image"),vo.forEach(t),jo.forEach(t),fn=c(R),Vl=a(R,"TD",{align:!0});var Zo=n(Vl);hn=r(Zo,"-"),Zo.forEach(t),mn=c(R),Rl=a(R,"TD",{align:!0});var _o=n(Rl);Ge=a(_o,"A",{href:!0,rel:!0});var Eo=n(Ge);dn=r(Eo,"Mikail Duzenli"),Eo.forEach(t),_o.forEach(t),R.forEach(t),I.forEach(t),Us.forEach(t),Qt=c(e),E=a(e,"P",{});var he=n(E);Mn=r(he,"To load a custom pipeline you just need to pass the "),it=a(he,"CODE",{});var Io=n(it);yn=r(Io,"custom_pipeline"),Io.forEach(t),bn=r(he," argument to "),ot=a(he,"CODE",{});var Go=n(ot);gn=r(Go,"DiffusionPipeline"),Go.forEach(t),Jn=r(he,", as one of the files in "),rt=a(he,"CODE",{});var Wo=n(rt);wn=r(Wo,"diffusers/examples/community"),Wo.forEach(t),Tn=r(he,". Feel free to send a PR with your own pipelines, we will merge them quickly."),he.forEach(t),Dt=c(e),m(We.$$.fragment,e),Yt=c(e),Y=a(e,"H2",{class:!0});var vs=n(Y);le=a(vs,"A",{id:!0,class:!0,href:!0});var Bo=n(le);pt=a(Bo,"SPAN",{});var ko=n(pt);m(Be.$$.fragment,ko),ko.forEach(t),Bo.forEach(t),Un=c(vs),ct=a(vs,"SPAN",{});var Co=n(ct);jn=r(Co,"Example usages"),Co.forEach(t),vs.forEach(t),xt=c(e),x=a(e,"H3",{class:!0});var Zs=n(x);te=a(Zs,"A",{id:!0,class:!0,href:!0});var Xo=n(te);ut=a(Xo,"SPAN",{});var Vo=n(ut);m(ke.$$.fragment,Vo),Vo.forEach(t),Xo.forEach(t),vn=c(Zs),ft=a(Zs,"SPAN",{});var Ro=n(ft);Zn=r(Ro,"CLIP Guided Stable Diffusion"),Ro.forEach(t),Zs.forEach(t),At=c(e),Sl=a(e,"P",{});var So=n(Sl);_n=r(So,`CLIP guided stable diffusion can help to generate more realistic images
by guiding stable diffusion at every denoising step with an additional CLIP model.`),So.forEach(t),Ft=c(e),Nl=a(e,"P",{});var No=n(Nl);En=r(No,"The following code requires roughly 12GB of GPU RAM."),No.forEach(t),zt=c(e),m(Ce.$$.fragment,e),$t=c(e),se=a(e,"P",{});var _s=n(se);In=r(_s,"The "),ht=a(_s,"CODE",{});var Qo=n(ht);Gn=r(Qo,"images"),Qo.forEach(t),Wn=r(_s,` list contains a list of PIL images that can be saved locally or displayed directly in a google colab.
Generated images tend to be of higher qualtiy than natively using stable diffusion. E.g. the above script generates the following images:`),_s.forEach(t),qt=c(e),Xe=a(e,"P",{});var Mi=n(Xe);Ql=a(Mi,"IMG",{src:!0,alt:!0}),Bn=r(Mi,"."),Mi.forEach(t),Ht=c(e),A=a(e,"H3",{class:!0});var Es=n(A);ae=a(Es,"A",{id:!0,class:!0,href:!0});var Do=n(ae);mt=a(Do,"SPAN",{});var Yo=n(mt);m(Ve.$$.fragment,Yo),Yo.forEach(t),Do.forEach(t),kn=c(Es),dt=a(Es,"SPAN",{});var xo=n(dt);Cn=r(xo,"One Step Unet"),xo.forEach(t),Es.forEach(t),Pt=c(e),Dl=a(e,"P",{});var Ao=n(Dl);Xn=r(Ao,"The dummy \u201Cone-step-unet\u201D can be run as follows:"),Ao.forEach(t),Lt=c(e),m(Re.$$.fragment,e),Kt=c(e),F=a(e,"P",{});var Ct=n(F);Mt=a(Ct,"STRONG",{});var Fo=n(Mt);Vn=r(Fo,"Note"),Fo.forEach(t),Rn=r(Ct,": This community pipeline is not useful as a feature, but rather just serves as an example of how community pipelines can be added (see "),Se=a(Ct,"A",{href:!0,rel:!0});var zo=n(Se);Sn=r(zo,"https://github.com/huggingface/diffusers/issues/841"),zo.forEach(t),Nn=r(Ct,")."),Ct.forEach(t),Ot=c(e),z=a(e,"H3",{class:!0});var Is=n(z);ne=a(Is,"A",{id:!0,class:!0,href:!0});var $o=n(ne);yt=a($o,"SPAN",{});var qo=n(yt);m(Ne.$$.fragment,qo),qo.forEach(t),$o.forEach(t),Qn=c(Is),bt=a(Is,"SPAN",{});var Ho=n(bt);Dn=r(Ho,"Stable Diffusion Interpolation"),Ho.forEach(t),Is.forEach(t),es=c(e),Yl=a(e,"P",{});var Po=n(Yl);Yn=r(Po,"The following code can be run on a GPU of at least 8GB VRAM and should take approximately 5 minutes."),Po.forEach(t),ls=c(e),m(Qe.$$.fragment,e),ts=c(e),G=a(e,"P",{});var Ll=n(G);xn=r(Ll,"The output of the "),gt=a(Ll,"CODE",{});var Lo=n(gt);An=r(Lo,"walk(...)"),Lo.forEach(t),Fn=r(Ll," function returns a list of images saved under the folder as defined in "),Jt=a(Ll,"CODE",{});var Ko=n(Jt);zn=r(Ko,"output_dir"),Ko.forEach(t),$n=r(Ll,". You can use these images to create videos of stable diffusion."),Ll.forEach(t),ss=c(e),xl=a(e,"BLOCKQUOTE",{});var Oo=n(xl);wt=a(Oo,"P",{});var er=n(wt);De=a(er,"STRONG",{});var Gs=n(De);qn=r(Gs,"Please have a look at "),Ye=a(Gs,"A",{href:!0,rel:!0});var lr=n(Ye);Hn=r(lr,"https://github.com/nateraw/stable-diffusion-videos"),lr.forEach(t),Pn=r(Gs," for more in-detail information on how to create videos using stable diffusion as well as more feature-complete functionality."),Gs.forEach(t),er.forEach(t),Oo.forEach(t),as=c(e),$=a(e,"H3",{class:!0});var Ws=n($);ie=a(Ws,"A",{id:!0,class:!0,href:!0});var tr=n(ie);Tt=a(tr,"SPAN",{});var sr=n(Tt);m(xe.$$.fragment,sr),sr.forEach(t),tr.forEach(t),Ln=c(Ws),Ut=a(Ws,"SPAN",{});var ar=n(Ut);Kn=r(ar,"Stable Diffusion Mega"),ar.forEach(t),Ws.forEach(t),ns=c(e),Al=a(e,"P",{});var nr=n(Al);On=r(nr,"The Stable Diffusion Mega Pipeline lets you use the main use cases of the stable diffusion pipeline in a single class."),nr.forEach(t),is=c(e),m(Ae.$$.fragment,e),os=c(e),Fl=a(e,"P",{});var ir=n(Fl);ei=r(ir,"As shown above this one pipeline can run all both \u201Ctext-to-image\u201D, \u201Cimage-to-image\u201D, and \u201Cinpainting\u201D in one pipeline."),ir.forEach(t),rs=c(e),q=a(e,"H3",{class:!0});var Bs=n(q);oe=a(Bs,"A",{id:!0,class:!0,href:!0});var or=n(oe);jt=a(or,"SPAN",{});var rr=n(jt);m(Fe.$$.fragment,rr),rr.forEach(t),or.forEach(t),li=c(Bs),vt=a(Bs,"SPAN",{});var pr=n(vt);ti=r(pr,"Long Prompt Weighting Stable Diffusion"),pr.forEach(t),Bs.forEach(t),ps=c(e),zl=a(e,"P",{});var cr=n(zl);si=r(cr,`The Pipeline lets you input prompt without 77 token length limit. And you can increase words weighting by using \u201D()\u201D or decrease words weighting by using \u201D[]\u201D
The Pipeline also lets you use the main use cases of the stable diffusion pipeline in a single class.`),cr.forEach(t),cs=c(e),H=a(e,"H4",{class:!0});var ks=n(H);re=a(ks,"A",{id:!0,class:!0,href:!0});var ur=n(re);Zt=a(ur,"SPAN",{});var fr=n(Zt);m(ze.$$.fragment,fr),fr.forEach(t),ur.forEach(t),ai=c(ks),_t=a(ks,"SPAN",{});var hr=n(_t);ni=r(hr,"pytorch"),hr.forEach(t),ks.forEach(t),us=c(e),m($e.$$.fragment,e),fs=c(e),P=a(e,"H4",{class:!0});var Cs=n(P);pe=a(Cs,"A",{id:!0,class:!0,href:!0});var mr=n(pe);Et=a(mr,"SPAN",{});var dr=n(Et);m(qe.$$.fragment,dr),dr.forEach(t),mr.forEach(t),ii=c(Cs),It=a(Cs,"SPAN",{});var Mr=n(It);oi=r(Mr,"onnxruntime"),Mr.forEach(t),Cs.forEach(t),hs=c(e),m(He.$$.fragment,e),ms=c(e),ce=a(e,"P",{});var Xs=n(ce);ri=r(Xs,"if you see "),Gt=a(Xs,"CODE",{});var yr=n(Gt);pi=r(yr,"Token indices sequence length is longer than the specified maximum sequence length for this model ( *** > 77 ) . Running this sequence through the model will result in indexing errors"),yr.forEach(t),ci=r(Xs,". Do not worry, it is normal."),Xs.forEach(t),ds=c(e),L=a(e,"H3",{class:!0});var Vs=n(L);ue=a(Vs,"A",{id:!0,class:!0,href:!0});var br=n(ue);Wt=a(br,"SPAN",{});var gr=n(Wt);m(Pe.$$.fragment,gr),gr.forEach(t),br.forEach(t),ui=c(Vs),Bt=a(Vs,"SPAN",{});var Jr=n(Bt);fi=r(Jr,"Speech to Image"),Jr.forEach(t),Vs.forEach(t),Ms=c(e),$l=a(e,"P",{});var wr=n($l);hi=r(wr,"The following code can generate an image from an audio sample using pre-trained OpenAI whisper-small and Stable Diffusion."),wr.forEach(t),ys=c(e),m(Le.$$.fragment,e),bs=c(e),ql=a(e,"P",{});var Tr=n(ql);mi=r(Tr,"This example produces the following image:"),Tr.forEach(t),gs=c(e),Hl=a(e,"P",{});var Ur=n(Hl);Pl=a(Ur,"IMG",{src:!0,alt:!0}),Ur.forEach(t),this.h()},h(){i(N,"name","hf:doc:metadata"),i(N,"content",JSON.stringify(Br)),i(K,"id","community-pipelines"),i(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"),i(K,"href","#community-pipelines"),i(Q,"class","relative group"),i(be,"href","https://github.com/huggingface/diffusers/issues/841"),i(be,"rel","nofollow"),i(Oe,"align","left"),i(el,"align","left"),i(ll,"align","left"),i(tl,"align","left"),i(sl,"align","right"),i(al,"align","left"),i(nl,"align","left"),i(ol,"href","#clip-guided-stable-diffusion"),i(il,"align","left"),yi(pl.src,gi="https://colab.research.google.com/assets/colab-badge.svg")||i(pl,"src",gi),i(pl,"alt","Open In Colab"),i(ge,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/CLIP_Guided_Stable_diffusion_with_diffusers.ipynb"),i(ge,"rel","nofollow"),i(rl,"align","left"),i(Je,"href","https://github.com/patil-suraj/"),i(Je,"rel","nofollow"),i(cl,"align","right"),i(ul,"align","left"),i(we,"href","https://github.com/huggingface/diffusers/issues/841"),i(we,"rel","nofollow"),i(ee,"align","left"),i(hl,"href","#one-step-unet"),i(fl,"align","left"),i(ml,"align","left"),i(Te,"href","https://github.com/patrickvonplaten/"),i(Te,"rel","nofollow"),i(dl,"align","right"),i(Ml,"align","left"),i(yl,"align","left"),i(gl,"href","#stable-diffusion-interpolation"),i(bl,"align","left"),i(Jl,"align","left"),i(Ue,"href","https://github.com/nateraw/"),i(Ue,"rel","nofollow"),i(wl,"align","right"),i(Tl,"align","left"),i(je,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py"),i(je,"rel","nofollow"),i(ve,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py"),i(ve,"rel","nofollow"),i(Ze,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py"),i(Ze,"rel","nofollow"),i(_,"align","left"),i(jl,"href","#stable-diffusion-mega"),i(Ul,"align","left"),i(vl,"align","left"),i(_e,"href","https://github.com/patrickvonplaten/"),i(_e,"rel","nofollow"),i(Zl,"align","right"),i(_l,"align","left"),i(Ee,"align","left"),i(Il,"href","#long-prompt-weighting-stable-diffusion"),i(El,"align","left"),i(Gl,"align","left"),i(Ie,"href","https://github.com/SkyTNT"),i(Ie,"rel","nofollow"),i(Wl,"align","right"),i(Bl,"align","left"),i(kl,"align","left"),i(Xl,"href","#speech-to-image"),i(Cl,"align","left"),i(Vl,"align","left"),i(Ge,"href","https://github.com/MikailINTech"),i(Ge,"rel","nofollow"),i(Rl,"align","right"),i(le,"id","example-usages"),i(le,"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"),i(le,"href","#example-usages"),i(Y,"class","relative group"),i(te,"id","clip-guided-stable-diffusion"),i(te,"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"),i(te,"href","#clip-guided-stable-diffusion"),i(x,"class","relative group"),yi(Ql.src,Ji="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/clip_guidance/merged_clip_guidance.jpg")||i(Ql,"src",Ji),i(Ql,"alt","clip_guidance"),i(ae,"id","one-step-unet"),i(ae,"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"),i(ae,"href","#one-step-unet"),i(A,"class","relative group"),i(Se,"href","https://github.com/huggingface/diffusers/issues/841"),i(Se,"rel","nofollow"),i(ne,"id","stable-diffusion-interpolation"),i(ne,"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"),i(ne,"href","#stable-diffusion-interpolation"),i(z,"class","relative group"),i(Ye,"href","https://github.com/nateraw/stable-diffusion-videos"),i(Ye,"rel","nofollow"),i(ie,"id","stable-diffusion-mega"),i(ie,"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"),i(ie,"href","#stable-diffusion-mega"),i($,"class","relative group"),i(oe,"id","long-prompt-weighting-stable-diffusion"),i(oe,"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"),i(oe,"href","#long-prompt-weighting-stable-diffusion"),i(q,"class","relative group"),i(re,"id","pytorch"),i(re,"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"),i(re,"href","#pytorch"),i(H,"class","relative group"),i(pe,"id","onnxruntime"),i(pe,"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"),i(pe,"href","#onnxruntime"),i(P,"class","relative group"),i(ue,"id","speech-to-image"),i(ue,"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"),i(ue,"href","#speech-to-image"),i(L,"class","relative group"),yi(Pl.src,wi="https://user-images.githubusercontent.com/45072645/196901736-77d9c6fc-63ee-4072-90b0-dc8b903d63e3.png")||i(Pl,"src",wi),i(Pl,"alt","image")},m(e,u){l(document.head,N),f(e,Xt,u),f(e,Q,u),l(Q,K),l(K,Kl),d(de,Kl,null),l(Q,Rs),l(Q,Ol),l(Ol,Ss),f(e,Vt,u),d(Me,e,u),f(e,Rt,u),f(e,Ke,u),l(Ke,et),l(et,ye),l(ye,Ns),l(ye,be),l(be,Qs),l(ye,Ds),f(e,St,u),f(e,D,u),l(D,lt),l(lt,Ys),l(D,xs),l(D,tt),l(tt,As),l(D,Fs),f(e,Nt,u),f(e,O,u),l(O,st),l(st,J),l(J,Oe),l(Oe,zs),l(J,$s),l(J,el),l(el,qs),l(J,Hs),l(J,ll),l(ll,Ps),l(J,Ls),l(J,tl),l(tl,Ks),l(J,Os),l(J,sl),l(sl,ea),l(O,la),l(O,g),l(g,w),l(w,al),l(al,ta),l(w,sa),l(w,nl),l(nl,aa),l(w,na),l(w,il),l(il,ol),l(ol,ia),l(w,oa),l(w,rl),l(rl,ge),l(ge,pl),l(w,ra),l(w,cl),l(cl,Je),l(Je,pa),l(g,ca),l(g,T),l(T,ul),l(ul,ua),l(T,fa),l(T,ee),l(ee,ha),l(ee,we),l(we,ma),l(ee,da),l(T,Ma),l(T,fl),l(fl,hl),l(hl,ya),l(T,ba),l(T,ml),l(ml,ga),l(T,Ja),l(T,dl),l(dl,Te),l(Te,wa),l(g,Ta),l(g,U),l(U,Ml),l(Ml,Ua),l(U,ja),l(U,yl),l(yl,va),l(U,Za),l(U,bl),l(bl,gl),l(gl,_a),l(U,Ea),l(U,Jl),l(Jl,Ia),l(U,Ga),l(U,wl),l(wl,Ue),l(Ue,Wa),l(g,Ba),l(g,j),l(j,Tl),l(Tl,ka),l(j,Ca),l(j,_),l(_,at),l(at,Xa),l(_,Va),l(_,je),l(je,Ra),l(_,Sa),l(_,ve),l(ve,Na),l(_,Qa),l(_,Ze),l(Ze,Da),l(j,Ya),l(j,Ul),l(Ul,jl),l(jl,xa),l(j,Aa),l(j,vl),l(vl,Fa),l(j,za),l(j,Zl),l(Zl,_e),l(_e,$a),l(g,qa),l(g,v),l(v,_l),l(_l,Ha),l(v,Pa),l(v,Ee),l(Ee,nt),l(nt,La),l(Ee,Ka),l(v,Oa),l(v,El),l(El,Il),l(Il,en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ye),l(Ye,Hn),l(De,Pn),f(e,as,u),f(e,$,u),l($,ie),l(ie,Tt),d(xe,Tt,null),l($,Ln),l($,Ut),l(Ut,Kn),f(e,ns,u),f(e,Al,u),l(Al,On),f(e,is,u),d(Ae,e,u),f(e,os,u),f(e,Fl,u),l(Fl,ei),f(e,rs,u),f(e,q,u),l(q,oe),l(oe,jt),d(Fe,jt,null),l(q,li),l(q,vt),l(vt,ti),f(e,ps,u),f(e,zl,u),l(zl,si),f(e,cs,u),f(e,H,u),l(H,re),l(re,Zt),d(ze,Zt,null),l(H,ai),l(H,_t),l(_t,ni),f(e,us,u),d($e,e,u),f(e,fs,u),f(e,P,u),l(P,pe),l(pe,Et),d(qe,Et,null),l(P,ii),l(P,It),l(It,oi),f(e,hs,u),d(He,e,u),f(e,ms,u),f(e,ce,u),l(ce,ri),l(ce,Gt),l(Gt,pi),l(ce,ci),f(e,ds,u),f(e,L,u),l(L,ue),l(ue,Wt),d(Pe,Wt,null),l(L,ui),l(L,Bt),l(Bt,fi),f(e,Ms,u),f(e,$l,u),l($l,hi),f(e,ys,u),d(Le,e,u),f(e,bs,u),f(e,ql,u),l(ql,mi),f(e,gs,u),f(e,Hl,u),l(Hl,Pl),Js=!0},p:Er,i(e){Js||(M(de.$$.fragment,e),M(Me.$$.fragment,e),M(We.$$.fragment,e),M(Be.$$.fragment,e),M(ke.$$.fragment,e),M(Ce.$$.fragment,e),M(Ve.$$.fragment,e),M(Re.$$.fragment,e),M(Ne.$$.fragment,e),M(Qe.$$.fragment,e),M(xe.$$.fragment,e),M(Ae.$$.fragment,e),M(Fe.$$.fragment,e),M(ze.$$.fragment,e),M($e.$$.fragment,e),M(qe.$$.fragment,e),M(He.$$.fragment,e),M(Pe.$$.fragment,e),M(Le.$$.fragment,e),Js=!0)},o(e){y(de.$$.fragment,e),y(Me.$$.fragment,e),y(We.$$.fragment,e),y(Be.$$.fragment,e),y(ke.$$.fragment,e),y(Ce.$$.fragment,e),y(Ve.$$.fragment,e),y(Re.$$.fragment,e),y(Ne.$$.fragment,e),y(Qe.$$.fragment,e),y(xe.$$.fragment,e),y(Ae.$$.fragment,e),y(Fe.$$.fragment,e),y(ze.$$.fragment,e),y($e.$$.fragment,e),y(qe.$$.fragment,e),y(He.$$.fragment,e),y(Pe.$$.fragment,e),y(Le.$$.fragment,e),Js=!1},d(e){t(N),e&&t(Xt),e&&t(Q),b(de),e&&t(Vt),b(Me,e),e&&t(Rt),e&&t(Ke),e&&t(St),e&&t(D),e&&t(Nt),e&&t(O),e&&t(Qt),e&&t(E),e&&t(Dt),b(We,e),e&&t(Yt),e&&t(Y),b(Be),e&&t(xt),e&&t(x),b(ke),e&&t(At),e&&t(Sl),e&&t(Ft),e&&t(Nl),e&&t(zt),b(Ce,e),e&&t($t),e&&t(se),e&&t(qt),e&&t(Xe),e&&t(Ht),e&&t(A),b(Ve),e&&t(Pt),e&&t(Dl),e&&t(Lt),b(Re,e),e&&t(Kt),e&&t(F),e&&t(Ot),e&&t(z),b(Ne),e&&t(es),e&&t(Yl),e&&t(ls),b(Qe,e),e&&t(ts),e&&t(G),e&&t(ss),e&&t(xl),e&&t(as),e&&t($),b(xe),e&&t(ns),e&&t(Al),e&&t(is),b(Ae,e),e&&t(os),e&&t(Fl),e&&t(rs),e&&t(q),b(Fe),e&&t(ps),e&&t(zl),e&&t(cs),e&&t(H),b(ze),e&&t(us),b($e,e),e&&t(fs),e&&t(P),b(qe),e&&t(hs),b(He,e),e&&t(ms),e&&t(ce),e&&t(ds),e&&t(L),b(Pe),e&&t(Ms),e&&t($l),e&&t(ys),b(Le,e),e&&t(bs),e&&t(ql),e&&t(gs),e&&t(Hl)}}}const Br={local:"community-pipelines",sections:[{local:"example-usages",sections:[{local:"clip-guided-stable-diffusion",title:"CLIP Guided Stable Diffusion"},{local:"one-step-unet",title:"One Step Unet"},{local:"stable-diffusion-interpolation",title:"Stable Diffusion Interpolation"},{local:"stable-diffusion-mega",title:"Stable Diffusion Mega"},{local:"long-prompt-weighting-stable-diffusion",sections:[{local:"pytorch",title:"pytorch"},{local:"onnxruntime",title:"onnxruntime"}],title:"Long Prompt Weighting Stable Diffusion"},{local:"speech-to-image",title:"Speech to Image"}],title:"Example usages"}],title:"Community pipelines"};function kr(bi){return Ir(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Sr extends jr{constructor(N){super();vr(this,N,kr,Wr,Zr,{})}}export{Sr as default,Br as metadata};
