import{S as xi,i as Yi,s as Xi,e as s,k as c,w as m,t as l,M as Hi,c as a,d as o,m as h,a as i,x as y,h as r,b as p,N as Pi,G as t,g as f,y as v,q as w,o as b,B as _,v as Li}from"../../chunks/vendor-hf-doc-builder.js";import{T as Vi}from"../../chunks/Tip-hf-doc-builder.js";import{I as $t}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as I}from"../../chunks/CodeBlock-hf-doc-builder.js";function zi(rt){let u,U,d,M,R,g,me,V;return{c(){u=s("p"),U=l("We highly recommend using the "),d=s("code"),M=l(".safetensors"),R=l(" format because it is more secure than traditional pickled files which are vulnerable and can be exploited to execute any code on your machine (learn more in the "),g=s("a"),me=l("Load safetensors"),V=l(" guide)."),this.h()},l(x){u=a(x,"P",{});var $=i(u);U=r($,"We highly recommend using the "),d=a($,"CODE",{});var J=i(d);M=r(J,".safetensors"),J.forEach(o),R=r($," format because it is more secure than traditional pickled files which are vulnerable and can be exploited to execute any code on your machine (learn more in the "),g=a($,"A",{href:!0});var st=i(g);me=r(st,"Load safetensors"),st.forEach(o),V=r($," guide)."),$.forEach(o),this.h()},h(){p(g,"href","using_safetensors")},m(x,$){f(x,u,$),t(u,U),t(u,d),t(d,M),t(u,R),t(u,g),t(g,me),t(u,V)},d(x){x&&o(u)}}}function Fi(rt){let u,U;return{c(){u=s("p"),U=l("\u{1F9EA} This is an experimental feature. Only Stable Diffusion v1 checkpoints are supported by the Convert KerasCV Space at the moment.")},l(d){u=a(d,"P",{});var M=i(u);U=r(M,"\u{1F9EA} This is an experimental feature. Only Stable Diffusion v1 checkpoints are supported by the Convert KerasCV Space at the moment."),M.forEach(o)},m(d,M){f(d,u,M),t(u,U)},d(d){d&&o(u)}}}function Qi(rt){let u,U,d,M,R,g,me,V,x,$,J,st,at,Gl,Il,it,jl,Sl,nt,Wl,Bl,Jo,q,To,ft,Al,go,Y,O,Ut,ye,Dl,Ct,Nl,Eo,k,Rl,Zt,Vl,xl,Gt,Yl,Xl,It,Hl,Pl,pt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:"huggingface-cli login"}}),Je=new I({props:{code:"Z2l0JTIwbGZzJTIwaW5zdGFsbCUwQWdpdCUyMGNsb25lJTIwaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRkNpYXJhUm93bGVzJTJGVGVtcG9yYWxOZXQ=",highlighted:`git lfs install
git <span class="hljs-built_in">clone</span> https://huggingface.co/CiaraRowles/TemporalNet`}}),ge=new I({props:{code:"Y2QlMjBUZW1wb3JhbE5ldCUyMCUyNiUyNiUyMGdpdCUyMGZldGNoJTIwb3JpZ2luJTIwcmVmcyUyRnByJTJGMTMlM0FwciUyRjEzJTBBZ2l0JTIwY2hlY2tvdXQlMjBwciUyRjEz",highlighted:`<span class="hljs-built_in">cd</span> TemporalNet &amp;&amp; git fetch origin refs/pr/13:<span class="hljs-built_in">pr</span>/13
git checkout <span class="hljs-built_in">pr</span>/13`}}),Ze=new I({props:{code:"cHl0aG9uJTIwLi4lMkZkaWZmdXNlcnMlMkZzY3JpcHRzJTJGY29udmVydF9vcmlnaW5hbF9zdGFibGVfZGlmZnVzaW9uX3RvX2RpZmZ1c2Vycy5weSUyMC0tY2hlY2twb2ludF9wYXRoJTIwdGVtcG9yYWxuZXR2My5ja3B0JTIwLS1vcmlnaW5hbF9jb25maWdfZmlsZSUyMGNsZG1fdjE1LnlhbWwlMjAtLWR1bXBfcGF0aCUyMC4lMkYlMjAtLWNvbnRyb2xuZXQ=",highlighted:"python ../diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py --checkpoint_path temporalnetv3.ckpt --original_config_file cldm_v15.yaml --dump_path ./ --controlnet"}}),Se=new I({props:{code:"Z2l0JTIwcHVzaCUyMG9yaWdpbiUyMHByJTJGMTMlM0FyZWZzJTJGcHIlMkYxMw==",highlighted:'git push origin <span class="hljs-built_in">pr</span>/13:refs/pr/13'}}),We=new $t({}),se=new Vi({props:{warning:!0,$$slots:{default:[Fi]},$$scope:{ctx:rt}}}),Xe=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc2F5YWtwYXVsJTJGdGV4dHVhbC1pbnZlcnNpb24tY2F0LWtlcmFzY3Zfc2RfZGlmZnVzZXJzX3BpcGVsaW5lJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;sayakpaul/textual-inversion-cat-kerascv_sd_diffusers_pipeline&quot;</span>)`}}),He=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc2F5YWtwYXVsJTJGdGV4dHVhbC1pbnZlcnNpb24tY2F0LWtlcmFzY3Zfc2RfZGlmZnVzZXJzX3BpcGVsaW5lJTIyKSUwQXBpcGVsaW5lLnRvKCUyMmN1ZGElMjIpJTBBJTBBcGxhY2Vob2xkZXJfdG9rZW4lMjAlM0QlMjAlMjIlM0NteS1mdW5ueS1jYXQtdG9rZW4lM0UlMjIlMEFwcm9tcHQlMjAlM0QlMjBmJTIydHdvJTIwJTdCcGxhY2Vob2xkZXJfdG9rZW4lN0QlMjBnZXR0aW5nJTIwbWFycmllZCUyQyUyMHBob3RvcmVhbGlzdGljJTJDJTIwaGlnaCUyMHF1YWxpdHklMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;sayakpaul/textual-inversion-cat-kerascv_sd_diffusers_pipeline&quot;</span>)
pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

placeholder_token = <span class="hljs-string">&quot;&lt;my-funny-cat-token&gt;&quot;</span>
prompt = <span class="hljs-string">f&quot;two <span class="hljs-subst">{placeholder_token}</span> getting married, photorealistic, high quality&quot;</span>
image = pipeline(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]`}}),Pe=new $t({}),Fe=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTJDJTIwVW5pUENNdWx0aXN0ZXBTY2hlZHVsZXIlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmFuZGl0ZSUyRmFueXRoaW5nLXY0LjAlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjBzYWZldHlfY2hlY2tlciUzRE5vbmUlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUuc2NoZWR1bGVyJTIwJTNEJTIwVW5pUENNdWx0aXN0ZXBTY2hlZHVsZXIuZnJvbV9jb25maWcocGlwZWxpbmUuc2NoZWR1bGVyLmNvbmZpZyk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, UniPCMultistepScheduler
<span class="hljs-keyword">import</span> torch

pipeline = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;andite/anything-v4.0&quot;</span>, torch_dtype=torch.float16, safety_checker=<span class="hljs-literal">None</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.scheduler = UniPCMultistepScheduler.from_config(pipeline.scheduler.config)`}}),qe=new I({props:{code:"IXdnZXQlMjBodHRwcyUzQSUyRiUyRmNpdml0YWkuY29tJTJGYXBpJTJGZG93bmxvYWQlMkZtb2RlbHMlMkYxOTk5OCUyMC1PJTIwaG93bHNfbW92aW5nX2Nhc3RsZS5zYWZldGVuc29ycw==",highlighted:"!wget https://civitai.com/api/download/models/19998 -O howls_moving_castle.safetensors"}}),Oe=new I({props:{code:"cGlwZWxpbmUubG9hZF9sb3JhX3dlaWdodHMoJTIyLiUyMiUyQyUyMHdlaWdodF9uYW1lJTNEJTIyaG93bHNfbW92aW5nX2Nhc3RsZS5zYWZldGVuc29ycyUyMik=",highlighted:'pipeline.load_lora_weights(<span class="hljs-string">&quot;.&quot;</span>, weight_name=<span class="hljs-string">&quot;howls_moving_castle.safetensors&quot;</span>)'}}),Ke=new I({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIybWFzdGVycGllY2UlMkMlMjBpbGx1c3RyYXRpb24lMkMlMjB1bHRyYS1kZXRhaWxlZCUyQyUyMGNpdHlzY2FwZSUyQyUyMHNhbiUyMGZyYW5jaXNjbyUyQyUyMGdvbGRlbiUyMGdhdGUlMjBicmlkZ2UlMkMlMjBjYWxpZm9ybmlhJTJDJTIwYmF5JTIwYXJlYSUyQyUyMGluJTIwdGhlJTIwc25vdyUyQyUyMGJlYXV0aWZ1bCUyMGRldGFpbGVkJTIwc3RhcnJ5JTIwc2t5JTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93cmVzJTJDJTIwY3JvcHBlZCUyQyUyMHdvcnN0JTIwcXVhbGl0eSUyQyUyMGxvdyUyMHF1YWxpdHklMkMlMjBub3JtYWwlMjBxdWFsaXR5JTJDJTIwYXJ0aWZhY3RzJTJDJTIwc2lnbmF0dXJlJTJDJTIwd2F0ZXJtYXJrJTJDJTIwdXNlcm5hbWUlMkMlMjBibHVycnklMkMlMjBtb3JlJTIwdGhhbiUyMG9uZSUyMGJyaWRnZSUyQyUyMGJhZCUyMGFyY2hpdGVjdHVyZSUyMiUwQSUwQWltYWdlcyUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNENTEyJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENTEyJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI1JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ltYWdlc19wZXJfcHJvbXB0JTNENCUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRHRvcmNoLm1hbnVhbF9zZWVkKDApJTJDJTBBKS5pbWFnZXM=",highlighted:`prompt = <span class="hljs-string">&quot;masterpiece, illustration, ultra-detailed, cityscape, san francisco, golden gate bridge, california, bay area, in the snow, beautiful detailed starry sky&quot;</span>
negative_prompt = <span class="hljs-string">&quot;lowres, cropped, worst quality, low quality, normal quality, artifacts, signature, watermark, username, blurry, more than one bridge, bad architecture&quot;</span>

images = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    width=<span class="hljs-number">512</span>,
    height=<span class="hljs-number">512</span>,
    num_inference_steps=<span class="hljs-number">25</span>,
    num_images_per_prompt=<span class="hljs-number">4</span>,
    generator=torch.manual_seed(<span class="hljs-number">0</span>),
).images`}}),et=new I({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBJTBBZGVmJTIwaW1hZ2VfZ3JpZChpbWdzJTJDJTIwcm93cyUzRDIlMkMlMjBjb2xzJTNEMiklM0ElMEElMjAlMjAlMjAlMjB3JTJDJTIwaCUyMCUzRCUyMGltZ3MlNUIwJTVELnNpemUlMEElMjAlMjAlMjAlMjBncmlkJTIwJTNEJTIwSW1hZ2UubmV3KCUyMlJHQiUyMiUyQyUyMHNpemUlM0QoY29scyUyMColMjB3JTJDJTIwcm93cyUyMColMjBoKSklMEElMEElMjAlMjAlMjAlMjBmb3IlMjBpJTJDJTIwaW1nJTIwaW4lMjBlbnVtZXJhdGUoaW1ncyklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBncmlkLnBhc3RlKGltZyUyQyUyMGJveCUzRChpJTIwJTI1JTIwY29scyUyMColMjB3JTJDJTIwaSUyMCUyRiUyRiUyMGNvbHMlMjAqJTIwaCkpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZ3JpZCUwQSUwQSUwQWltYWdlX2dyaWQoaW1hZ2VzKQ==",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image


<span class="hljs-keyword">def</span> <span class="hljs-title function_">image_grid</span>(<span class="hljs-params">imgs, rows=<span class="hljs-number">2</span>, cols=<span class="hljs-number">2</span></span>):
    w, h = imgs[<span class="hljs-number">0</span>].size
    grid = Image.new(<span class="hljs-string">&quot;RGB&quot;</span>, size=(cols * w, rows * h))

    <span class="hljs-keyword">for</span> i, img <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(imgs):
        grid.paste(img, box=(i % cols * w, i // cols * h))
    <span class="hljs-keyword">return</span> grid


image_grid(images)`}}),{c(){u=s("meta"),U=c(),d=s("h1"),M=s("a"),R=s("span"),m(g.$$.fragment),me=c(),V=s("span"),x=l("Load different Stable Diffusion formats"),$=c(),J=s("p"),st=l("Stable Diffusion models are available in different formats depending on the framework they\u2019re trained and saved with, and where you download them from. Converting these formats for use in \u{1F917} Diffusers allows you to use all the features supported by the library, such as "),at=s("a"),Gl=l("using different schedulers"),Il=l(" for inference, "),it=s("a"),jl=l("building your custom pipeline"),Sl=l(", and a variety of techniques and methods for "),nt=s("a"),Wl=l("optimizing inference speed"),Bl=l("."),Jo=c(),m(q.$$.fragment),To=c(),ft=s("p"),Al=l("This guide will show you how to convert other Stable Diffusion formats to be compatible with \u{1F917} Diffusers."),go=c(),Y=s("h2"),O=s("a"),Ut=s("span"),m(ye.$$.fragment),Dl=c(),Ct=s("span"),Nl=l("PyTorch .ckpt"),Eo=c(),k=s("p"),Rl=l("The checkpoint - or "),Zt=s("code"),Vl=l(".ckpt"),xl=l(" - format is commonly used to store and save models. The "),Gt=s("code"),Yl=l(".ckpt"),Xl=l(" file contains the entire model and is typically several GBs in size. While you can load and use a "),It=s("code"),Hl=l(".ckpt"),Pl=l(" file directly with the "),pt=s("a"),Ll=l("from_ckpt()"),zl=l(" method, it is generally better to convert the "),jt=s("code"),Fl=l(".ckpt"),Ql=l(" file to \u{1F917} Diffusers so both formats are available."),$o=c(),B=s("p"),ql=l("There are two options for converting a "),St=s("code"),Ol=l(".ckpt"),Kl=l(" file; use a Space to convert the checkpoint or convert the "),Wt=s("code"),er=l(".ckpt"),tr=l(" file with a script."),Uo=c(),X=s("h3"),K=s("a"),Bt=s("span"),m(ve.$$.fragment),or=c(),At=s("span"),lr=l("Convert with a Space"),Co=c(),C=s("p"),rr=l("The easiest and most convenient way to convert a "),Dt=s("code"),sr=l(".ckpt"),ar=l(" file is to use the "),we=s("a"),ir=l("SD to Diffusers"),nr=l(" Space. You can follow the instructions on the Space to convert the "),Nt=s("code"),fr=l(".ckpt"),pr=l(" file."),Zo=c(),ee=s("p"),cr=l("This approach works well for basic models, but it may struggle with more customized models. You\u2019ll know the Space failed if it returns an empty pull request or error. In this case, you can try converting the "),Rt=s("code"),hr=l(".ckpt"),ur=l(" file with a script."),Go=c(),H=s("h3"),te=s("a"),Vt=s("span"),m(be.$$.fragment),dr=c(),xt=s("span"),mr=l("Convert with a script"),Io=c(),A=s("p"),yr=l("\u{1F917} Diffusers provides a "),_e=s("a"),vr=l("conversion script"),wr=l(" for converting "),Yt=s("code"),br=l(".ckpt"),_r=l(" files. This approach is more reliable than the Space above."),jo=c(),ct=s("p"),Mr=l("Before you start, make sure you have a local clone of \u{1F917} Diffusers to run the script and log in to your Hugging Face account so you can open pull requests and push your converted model to the Hub."),So=c(),m(Me.$$.fragment),Wo=c(),ht=s("p"),kr=l("To use the script:"),Bo=c(),ut=s("ol"),j=s("li"),Jr=l("Git clone the repository containing the "),Xt=s("code"),Tr=l(".ckpt"),gr=l(" file you want to convert. For this example, let\u2019s convert this "),ke=s("a"),Er=l("TemporalNet"),$r=c(),Ht=s("code"),Ur=l(".ckpt"),Cr=l(" file:"),Ao=c(),m(Je.$$.fragment),Do=c(),Te=s("ol"),Pt=s("li"),Zr=l("Open a pull request on the repository where you\u2019re converting the checkpoint from:"),No=c(),m(ge.$$.fragment),Ro=c(),P=s("ol"),Ee=s("li"),Lt=s("p"),Gr=l("There are several input arguments to configure in the conversion script, but the most important ones are:"),Ir=c(),L=s("ul"),zt=s("li"),oe=s("p"),Ft=s("code"),jr=l("checkpoint_path"),Sr=l(": the path to the "),Qt=s("code"),Wr=l(".ckpt"),Br=l(" file to convert."),Ar=c(),qt=s("li"),le=s("p"),Ot=s("code"),Dr=l("original_config_file"),Nr=l(": a YAML file defining the configuration of the original architecture. If you can\u2019t find this file, try searching for the YAML file in the GitHub repository where you found the "),Kt=s("code"),Rr=l(".ckpt"),Vr=l(" file."),xr=c(),$e=s("li"),dt=s("p"),eo=s("code"),Yr=l("dump_path"),Xr=l(": the path to the converted model."),Hr=c(),z=s("p"),Pr=l("For example, you can take the "),to=s("code"),Lr=l("cldm_v15.yaml"),zr=l(" file from the "),Ue=s("a"),Fr=l("ControlNet"),Qr=l(" repository because the TemporalNet model is a Stable Diffusion v1.5 and ControlNet model."),qr=c(),oo=s("li"),Ce=s("p"),Or=l("Now you can run the script to convert the "),lo=s("code"),Kr=l(".ckpt"),es=l(" file:"),Vo=c(),m(Ze.$$.fragment),xo=c(),Ge=s("ol"),Ie=s("li"),ts=l("Once the conversion is done, upload your converted model and test out the resulting "),je=s("a"),os=l("pull request"),ls=l("!"),Yo=c(),m(Se.$$.fragment),Xo=c(),F=s("h2"),re=s("a"),ro=s("span"),m(We.$$.fragment),rs=c(),so=s("span"),ss=l("Keras .pb or .h5"),Ho=c(),m(se.$$.fragment),Po=c(),T=s("p"),Be=s("a"),as=l("KerasCV"),is=l(" supports training for "),Ae=s("a"),ns=l("Stable Diffusion"),fs=l(" v1 and v2. However, it offers limited support for experimenting with Stable Diffusion models for inference and deployment whereas \u{1F917} Diffusers has a more complete set of features for this purpose, such as different "),De=s("a"),ps=l("noise schedulers"),cs=l(", "),Ne=s("a"),hs=l("flash attention"),us=l(", and "),Re=s("a"),ds=l(`other
optimization techniques`),ms=l("."),Lo=c(),E=s("p"),ys=l("The "),Ve=s("a"),vs=l("Convert KerasCV"),ws=l(" Space converts "),ao=s("code"),bs=l(".pb"),_s=l(" or "),io=s("code"),Ms=l(".h5"),ks=l(" files to PyTorch, and then wraps them in a "),mt=s("a"),Js=l("StableDiffusionPipeline"),Ts=l(" so it is ready for inference. The converted checkpoint is stored in a repository on the Hugging Face Hub."),zo=c(),D=s("p"),gs=l("For this example, let\u2019s convert the "),xe=s("a"),no=s("code"),Es=l("sayakpaul/textual-inversion-kerasio"),$s=l(" checkpoint which was trained with Textual Inversion. It uses the special token "),fo=s("code"),Us=l("<my-funny-cat>"),Cs=l(" to personalize images with cats."),Fo=c(),yt=s("p"),Zs=l("The Convert KerasCV Space allows you to input the following:"),Qo=c(),Z=s("ul"),po=s("li"),Gs=l("Your Hugging Face token."),Is=c(),co=s("li"),js=l("Paths to download the UNet and text encoder weights from. Depending on how the model was trained, you don\u2019t necessarily need to provide the paths to both the UNet and text encoder. For example, Textual Inversion only requires the embeddings from the text encoder and a text-to-image model only requires the UNet weights."),Ss=c(),ho=s("li"),Ws=l("Placeholder token is only applicable for textual inversion models."),Bs=c(),Ye=s("li"),As=l("The "),uo=s("code"),Ds=l("output_repo_prefix"),Ns=l(" is the name of the repository where the converted model is stored."),qo=c(),ae=s("p"),Rs=l("Click the "),mo=s("strong"),Vs=l("Submit"),xs=l(" button to automatically convert the KerasCV checkpoint! Once the checkpoint is successfully converted, you\u2019ll see a link to the new repository containing the converted checkpoint. Follow the link to the new repository, and you\u2019ll see the Convert KerasCV Space generated a model card with an inference widget to try out the converted model."),Oo=c(),ie=s("p"),Ys=l("If you prefer to run inference with code, click on the "),yo=s("strong"),Xs=l("Use in Diffusers"),Hs=l(" button in the upper right corner of the model card to copy and paste the code snippet:"),Ko=c(),m(Xe.$$.fragment),el=c(),vt=s("p"),Ps=l("Then you can generate an image like:"),tl=c(),m(He.$$.fragment),ol=c(),Q=s("h2"),ne=s("a"),vo=s("span"),m(Pe.$$.fragment),Ls=c(),wo=s("span"),zs=l("A1111 LoRA files"),ll=c(),S=s("p"),Le=s("a"),Fs=l("Automatic1111"),Qs=l(" (A1111) is a popular web UI for Stable Diffusion that supports model sharing platforms like "),ze=s("a"),qs=l("Civitai"),Os=l(". Models trained with the Low-Rank Adaptation (LoRA) technique are especially popular because they\u2019re fast to train and have a much smaller file size than a fully finetuned model. \u{1F917} Diffusers supports loading A1111 LoRA checkpoints with "),wt=s("a"),Ks=l("load_lora_weights()"),ea=l(":"),rl=c(),m(Fe.$$.fragment),sl=c(),fe=s("p"),ta=l("Download a LoRA checkpoint from Civitai; this example uses the "),Qe=s("a"),oa=l("Howls Moving Castle,Interior/Scenery LoRA (Ghibli Stlye)"),la=l(" checkpoint, but feel free to try out any LoRA checkpoint!"),al=c(),m(qe.$$.fragment),il=c(),pe=s("p"),ra=l("Load the LoRA checkpoint into the pipeline with the "),bt=s("a"),sa=l("load_lora_weights()"),aa=l(" method:"),nl=c(),m(Oe.$$.fragment),fl=c(),_t=s("p"),ia=l("Now you can use the pipeline to generate images:"),pl=c(),m(Ke.$$.fragment),cl=c(),Mt=s("p"),na=l("Finally, create a helper function to display the images:"),hl=c(),m(et.$$.fragment),ul=c(),tt=s("div"),bo=s("img"),this.h()},l(e){const n=Hi('[data-svelte="svelte-1phssyn"]',document.head);u=a(n,"META",{name:!0,content:!0}),n.forEach(o),U=h(e),d=a(e,"H1",{class:!0});var ot=i(d);M=a(ot,"A",{id:!0,class:!0,href:!0});var _o=i(M);R=a(_o,"SPAN",{});var ca=i(R);y(g.$$.fragment,ca),ca.forEach(o),_o.forEach(o),me=h(ot),V=a(ot,"SPAN",{});var ha=i(V);x=r(ha,"Load different Stable Diffusion formats"),ha.forEach(o),ot.forEach(o),$=h(e),J=a(e,"P",{});var ce=i(J);st=r(ce,"Stable Diffusion models are available in different formats depending on the framework they\u2019re trained and saved with, and where you download them from. Converting these formats for use in \u{1F917} Diffusers allows you to use all the features supported by the library, such as "),at=a(ce,"A",{href:!0});var ua=i(at);Gl=r(ua,"using different schedulers"),ua.forEach(o),Il=r(ce," for inference, "),it=a(ce,"A",{href:!0});var da=i(it);jl=r(da,"building your custom pipeline"),da.forEach(o),Sl=r(ce,", and a variety of techniques and methods for "),nt=a(ce,"A",{href:!0});var ma=i(nt);Wl=r(ma,"optimizing inference speed"),ma.forEach(o),Bl=r(ce,"."),ce.forEach(o),Jo=h(e),y(q.$$.fragment,e),To=h(e),ft=a(e,"P",{});var ya=i(ft);Al=r(ya,"This guide will show you how to convert other Stable Diffusion formats to be compatible with \u{1F917} Diffusers."),ya.forEach(o),go=h(e),Y=a(e,"H2",{class:!0});var ml=i(Y);O=a(ml,"A",{id:!0,class:!0,href:!0});var va=i(O);Ut=a(va,"SPAN",{});var wa=i(Ut);y(ye.$$.fragment,wa),wa.forEach(o),va.forEach(o),Dl=h(ml),Ct=a(ml,"SPAN",{});var ba=i(Ct);Nl=r(ba,"PyTorch .ckpt"),ba.forEach(o),ml.forEach(o),Eo=h(e),k=a(e,"P",{});var G=i(k);Rl=r(G,"The checkpoint - or "),Zt=a(G,"CODE",{});var _a=i(Zt);Vl=r(_a,".ckpt"),_a.forEach(o),xl=r(G," - format is commonly used to store and save models. The "),Gt=a(G,"CODE",{});var Ma=i(Gt);Yl=r(Ma,".ckpt"),Ma.forEach(o),Xl=r(G," file contains the entire model and is typically several GBs in size. While you can load and use a "),It=a(G,"CODE",{});var ka=i(It);Hl=r(ka,".ckpt"),ka.forEach(o),Pl=r(G," file directly with the "),pt=a(G,"A",{href:!0});var Ja=i(pt);Ll=r(Ja,"from_ckpt()"),Ja.forEach(o),zl=r(G," method, it is generally better to convert the "),jt=a(G,"CODE",{});var Ta=i(jt);Fl=r(Ta,".ckpt"),Ta.forEach(o),Ql=r(G," file to \u{1F917} Diffusers so both formats are available."),G.forEach(o),$o=h(e),B=a(e,"P",{});var kt=i(B);ql=r(kt,"There are two options for converting a "),St=a(kt,"CODE",{});var ga=i(St);Ol=r(ga,".ckpt"),ga.forEach(o),Kl=r(kt," file; use a Space to convert the checkpoint or convert the "),Wt=a(kt,"CODE",{});var Ea=i(Wt);er=r(Ea,".ckpt"),Ea.forEach(o),tr=r(kt," file with a script."),kt.forEach(o),Uo=h(e),X=a(e,"H3",{class:!0});var yl=i(X);K=a(yl,"A",{id:!0,class:!0,href:!0});var $a=i(K);Bt=a($a,"SPAN",{});var Ua=i(Bt);y(ve.$$.fragment,Ua),Ua.forEach(o),$a.forEach(o),or=h(yl),At=a(yl,"SPAN",{});var Ca=i(At);lr=r(Ca,"Convert with a Space"),Ca.forEach(o),yl.forEach(o),Co=h(e),C=a(e,"P",{});var he=i(C);rr=r(he,"The easiest and most convenient way to convert a "),Dt=a(he,"CODE",{});var Za=i(Dt);sr=r(Za,".ckpt"),Za.forEach(o),ar=r(he," file is to use the "),we=a(he,"A",{href:!0,rel:!0});var Ga=i(we);ir=r(Ga,"SD to Diffusers"),Ga.forEach(o),nr=r(he," Space. You can follow the instructions on the Space to convert the "),Nt=a(he,"CODE",{});var Ia=i(Nt);fr=r(Ia,".ckpt"),Ia.forEach(o),pr=r(he," file."),he.forEach(o),Zo=h(e),ee=a(e,"P",{});var vl=i(ee);cr=r(vl,"This approach works well for basic models, but it may struggle with more customized models. You\u2019ll know the Space failed if it returns an empty pull request or error. In this case, you can try converting the "),Rt=a(vl,"CODE",{});var ja=i(Rt);hr=r(ja,".ckpt"),ja.forEach(o),ur=r(vl," file with a script."),vl.forEach(o),Go=h(e),H=a(e,"H3",{class:!0});var wl=i(H);te=a(wl,"A",{id:!0,class:!0,href:!0});var Sa=i(te);Vt=a(Sa,"SPAN",{});var Wa=i(Vt);y(be.$$.fragment,Wa),Wa.forEach(o),Sa.forEach(o),dr=h(wl),xt=a(wl,"SPAN",{});var Ba=i(xt);mr=r(Ba,"Convert with a script"),Ba.forEach(o),wl.forEach(o),Io=h(e),A=a(e,"P",{});var Jt=i(A);yr=r(Jt,"\u{1F917} Diffusers provides a "),_e=a(Jt,"A",{href:!0,rel:!0});var Aa=i(_e);vr=r(Aa,"conversion script"),Aa.forEach(o),wr=r(Jt," for converting "),Yt=a(Jt,"CODE",{});var Da=i(Yt);br=r(Da,".ckpt"),Da.forEach(o),_r=r(Jt," files. This approach is more reliable than the Space above."),Jt.forEach(o),jo=h(e),ct=a(e,"P",{});var Na=i(ct);Mr=r(Na,"Before you start, make sure you have a local clone of \u{1F917} Diffusers to run the script and log in to your Hugging Face account so you can open pull requests and push your converted model to the Hub."),Na.forEach(o),So=h(e),y(Me.$$.fragment,e),Wo=h(e),ht=a(e,"P",{});var Ra=i(ht);kr=r(Ra,"To use the script:"),Ra.forEach(o),Bo=h(e),ut=a(e,"OL",{});var Va=i(ut);j=a(Va,"LI",{});var ue=i(j);Jr=r(ue,"Git clone the repository containing the "),Xt=a(ue,"CODE",{});var xa=i(Xt);Tr=r(xa,".ckpt"),xa.forEach(o),gr=r(ue," file you want to convert. For this example, let\u2019s convert this "),ke=a(ue,"A",{href:!0,rel:!0});var Ya=i(ke);Er=r(Ya,"TemporalNet"),Ya.forEach(o),$r=h(ue),Ht=a(ue,"CODE",{});var Xa=i(Ht);Ur=r(Xa,".ckpt"),Xa.forEach(o),Cr=r(ue," file:"),ue.forEach(o),Va.forEach(o),Ao=h(e),y(Je.$$.fragment,e),Do=h(e),Te=a(e,"OL",{start:!0});var Ha=i(Te);Pt=a(Ha,"LI",{});var Pa=i(Pt);Zr=r(Pa,"Open a pull request on the repository where you\u2019re converting the checkpoint from:"),Pa.forEach(o),Ha.forEach(o),No=h(e),y(ge.$$.fragment,e),Ro=h(e),P=a(e,"OL",{start:!0});var bl=i(P);Ee=a(bl,"LI",{});var _l=i(Ee);Lt=a(_l,"P",{});var La=i(Lt);Gr=r(La,"There are several input arguments to configure in the conversion script, but the most important ones are:"),La.forEach(o),Ir=h(_l),L=a(_l,"UL",{});var Tt=i(L);zt=a(Tt,"LI",{});var za=i(zt);oe=a(za,"P",{});var Mo=i(oe);Ft=a(Mo,"CODE",{});var Fa=i(Ft);jr=r(Fa,"checkpoint_path"),Fa.forEach(o),Sr=r(Mo,": the path to the "),Qt=a(Mo,"CODE",{});var Qa=i(Qt);Wr=r(Qa,".ckpt"),Qa.forEach(o),Br=r(Mo," file to convert."),Mo.forEach(o),za.forEach(o),Ar=h(Tt),qt=a(Tt,"LI",{});var qa=i(qt);le=a(qa,"P",{});var ko=i(le);Ot=a(ko,"CODE",{});var Oa=i(Ot);Dr=r(Oa,"original_config_file"),Oa.forEach(o),Nr=r(ko,": a YAML file defining the configuration of the original architecture. If you can\u2019t find this file, try searching for the YAML file in the GitHub repository where you found the "),Kt=a(ko,"CODE",{});var Ka=i(Kt);Rr=r(Ka,".ckpt"),Ka.forEach(o),Vr=r(ko," file."),ko.forEach(o),qa.forEach(o),xr=h(Tt),$e=a(Tt,"LI",{});var Ml=i($e);dt=a(Ml,"P",{});var fa=i(dt);eo=a(fa,"CODE",{});var ei=i(eo);Yr=r(ei,"dump_path"),ei.forEach(o),Xr=r(fa,": the path to the converted model."),fa.forEach(o),Hr=h(Ml),z=a(Ml,"P",{});var gt=i(z);Pr=r(gt,"For example, you can take the "),to=a(gt,"CODE",{});var ti=i(to);Lr=r(ti,"cldm_v15.yaml"),ti.forEach(o),zr=r(gt," file from the "),Ue=a(gt,"A",{href:!0,rel:!0});var oi=i(Ue);Fr=r(oi,"ControlNet"),oi.forEach(o),Qr=r(gt," repository because the TemporalNet model is a Stable Diffusion v1.5 and ControlNet model."),gt.forEach(o),Ml.forEach(o),Tt.forEach(o),_l.forEach(o),qr=h(bl),oo=a(bl,"LI",{});var li=i(oo);Ce=a(li,"P",{});var kl=i(Ce);Or=r(kl,"Now you can run the script to convert the "),lo=a(kl,"CODE",{});var ri=i(lo);Kr=r(ri,".ckpt"),ri.forEach(o),es=r(kl," file:"),kl.forEach(o),li.forEach(o),bl.forEach(o),Vo=h(e),y(Ze.$$.fragment,e),xo=h(e),Ge=a(e,"OL",{start:!0});var si=i(Ge);Ie=a(si,"LI",{});var Jl=i(Ie);ts=r(Jl,"Once the conversion is done, upload your converted model and test out the resulting "),je=a(Jl,"A",{href:!0,rel:!0});var ai=i(je);os=r(ai,"pull request"),ai.forEach(o),ls=r(Jl,"!"),Jl.forEach(o),si.forEach(o),Yo=h(e),y(Se.$$.fragment,e),Xo=h(e),F=a(e,"H2",{class:!0});var Tl=i(F);re=a(Tl,"A",{id:!0,class:!0,href:!0});var ii=i(re);ro=a(ii,"SPAN",{});var ni=i(ro);y(We.$$.fragment,ni),ni.forEach(o),ii.forEach(o),rs=h(Tl),so=a(Tl,"SPAN",{});var fi=i(so);ss=r(fi,"Keras .pb or .h5"),fi.forEach(o),Tl.forEach(o),Ho=h(e),y(se.$$.fragment,e),Po=h(e),T=a(e,"P",{});var W=i(T);Be=a(W,"A",{href:!0,rel:!0});var pi=i(Be);as=r(pi,"KerasCV"),pi.forEach(o),is=r(W," supports training for "),Ae=a(W,"A",{href:!0,rel:!0});var ci=i(Ae);ns=r(ci,"Stable Diffusion"),ci.forEach(o),fs=r(W," v1 and v2. However, it offers limited support for experimenting with Stable Diffusion models for inference and deployment whereas \u{1F917} Diffusers has a more complete set of features for this purpose, such as different "),De=a(W,"A",{href:!0,rel:!0});var hi=i(De);ps=r(hi,"noise schedulers"),hi.forEach(o),cs=r(W,", "),Ne=a(W,"A",{href:!0,rel:!0});var ui=i(Ne);hs=r(ui,"flash attention"),ui.forEach(o),us=r(W,", and "),Re=a(W,"A",{href:!0,rel:!0});var di=i(Re);ds=r(di,`other
optimization techniques`),di.forEach(o),ms=r(W,"."),W.forEach(o),Lo=h(e),E=a(e,"P",{});var N=i(E);ys=r(N,"The "),Ve=a(N,"A",{href:!0,rel:!0});var mi=i(Ve);vs=r(mi,"Convert KerasCV"),mi.forEach(o),ws=r(N," Space converts "),ao=a(N,"CODE",{});var yi=i(ao);bs=r(yi,".pb"),yi.forEach(o),_s=r(N," or "),io=a(N,"CODE",{});var vi=i(io);Ms=r(vi,".h5"),vi.forEach(o),ks=r(N," files to PyTorch, and then wraps them in a "),mt=a(N,"A",{href:!0});var wi=i(mt);Js=r(wi,"StableDiffusionPipeline"),wi.forEach(o),Ts=r(N," so it is ready for inference. The converted checkpoint is stored in a repository on the Hugging Face Hub."),N.forEach(o),zo=h(e),D=a(e,"P",{});var Et=i(D);gs=r(Et,"For this example, let\u2019s convert the "),xe=a(Et,"A",{href:!0,rel:!0});var bi=i(xe);no=a(bi,"CODE",{});var _i=i(no);Es=r(_i,"sayakpaul/textual-inversion-kerasio"),_i.forEach(o),bi.forEach(o),$s=r(Et," checkpoint which was trained with Textual Inversion. It uses the special token "),fo=a(Et,"CODE",{});var Mi=i(fo);Us=r(Mi,"<my-funny-cat>"),Mi.forEach(o),Cs=r(Et," to personalize images with cats."),Et.forEach(o),Fo=h(e),yt=a(e,"P",{});var ki=i(yt);Zs=r(ki,"The Convert KerasCV Space allows you to input the following:"),ki.forEach(o),Qo=h(e),Z=a(e,"UL",{});var de=i(Z);po=a(de,"LI",{});var Ji=i(po);Gs=r(Ji,"Your Hugging Face token."),Ji.forEach(o),Is=h(de),co=a(de,"LI",{});var Ti=i(co);js=r(Ti,"Paths to download the UNet and text encoder weights from. Depending on how the model was trained, you don\u2019t necessarily need to provide the paths to both the UNet and text encoder. For example, Textual Inversion only requires the embeddings from the text encoder and a text-to-image model only requires the UNet weights."),Ti.forEach(o),Ss=h(de),ho=a(de,"LI",{});var gi=i(ho);Ws=r(gi,"Placeholder token is only applicable for textual inversion models."),gi.forEach(o),Bs=h(de),Ye=a(de,"LI",{});var gl=i(Ye);As=r(gl,"The "),uo=a(gl,"CODE",{});var Ei=i(uo);Ds=r(Ei,"output_repo_prefix"),Ei.forEach(o),Ns=r(gl," is the name of the repository where the converted model is stored."),gl.forEach(o),de.forEach(o),qo=h(e),ae=a(e,"P",{});var El=i(ae);Rs=r(El,"Click the "),mo=a(El,"STRONG",{});var $i=i(mo);Vs=r($i,"Submit"),$i.forEach(o),xs=r(El," button to automatically convert the KerasCV checkpoint! Once the checkpoint is successfully converted, you\u2019ll see a link to the new repository containing the converted checkpoint. Follow the link to the new repository, and you\u2019ll see the Convert KerasCV Space generated a model card with an inference widget to try out the converted model."),El.forEach(o),Oo=h(e),ie=a(e,"P",{});var $l=i(ie);Ys=r($l,"If you prefer to run inference with code, click on the "),yo=a($l,"STRONG",{});var Ui=i(yo);Xs=r(Ui,"Use in Diffusers"),Ui.forEach(o),Hs=r($l," button in the upper right corner of the model card to copy and paste the code snippet:"),$l.forEach(o),Ko=h(e),y(Xe.$$.fragment,e),el=h(e),vt=a(e,"P",{});var Ci=i(vt);Ps=r(Ci,"Then you can generate an image like:"),Ci.forEach(o),tl=h(e),y(He.$$.fragment,e),ol=h(e),Q=a(e,"H2",{class:!0});var Ul=i(Q);ne=a(Ul,"A",{id:!0,class:!0,href:!0});var Zi=i(ne);vo=a(Zi,"SPAN",{});var Gi=i(vo);y(Pe.$$.fragment,Gi),Gi.forEach(o),Zi.forEach(o),Ls=h(Ul),wo=a(Ul,"SPAN",{});var Ii=i(wo);zs=r(Ii,"A1111 LoRA files"),Ii.forEach(o),Ul.forEach(o),ll=h(e),S=a(e,"P",{});var lt=i(S);Le=a(lt,"A",{href:!0,rel:!0});var ji=i(Le);Fs=r(ji,"Automatic1111"),ji.forEach(o),Qs=r(lt," (A1111) is a popular web UI for Stable Diffusion that supports model sharing platforms like "),ze=a(lt,"A",{href:!0,rel:!0});var Si=i(ze);qs=r(Si,"Civitai"),Si.forEach(o),Os=r(lt,". Models trained with the Low-Rank Adaptation (LoRA) technique are especially popular because they\u2019re fast to train and have a much smaller file size than a fully finetuned model. \u{1F917} Diffusers supports loading A1111 LoRA checkpoints with "),wt=a(lt,"A",{href:!0});var Wi=i(wt);Ks=r(Wi,"load_lora_weights()"),Wi.forEach(o),ea=r(lt,":"),lt.forEach(o),rl=h(e),y(Fe.$$.fragment,e),sl=h(e),fe=a(e,"P",{});var Cl=i(fe);ta=r(Cl,"Download a LoRA checkpoint from Civitai; this example uses the "),Qe=a(Cl,"A",{href:!0,rel:!0});var Bi=i(Qe);oa=r(Bi,"Howls Moving Castle,Interior/Scenery LoRA (Ghibli Stlye)"),Bi.forEach(o),la=r(Cl," checkpoint, but feel free to try out any LoRA checkpoint!"),Cl.forEach(o),al=h(e),y(qe.$$.fragment,e),il=h(e),pe=a(e,"P",{});var Zl=i(pe);ra=r(Zl,"Load the LoRA checkpoint into the pipeline with the "),bt=a(Zl,"A",{href:!0});var Ai=i(bt);sa=r(Ai,"load_lora_weights()"),Ai.forEach(o),aa=r(Zl," method:"),Zl.forEach(o),nl=h(e),y(Oe.$$.fragment,e),fl=h(e),_t=a(e,"P",{});var Di=i(_t);ia=r(Di,"Now you can use the pipeline to generate images:"),Di.forEach(o),pl=h(e),y(Ke.$$.fragment,e),cl=h(e),Mt=a(e,"P",{});var Ni=i(Mt);na=r(Ni,"Finally, create a helper function to display the images:"),Ni.forEach(o),hl=h(e),y(et.$$.fragment,e),ul=h(e),tt=a(e,"DIV",{class:!0});var Ri=i(tt);bo=a(Ri,"IMG",{src:!0}),Ri.forEach(o),this.h()},h(){p(u,"name","hf:doc:metadata"),p(u,"content",JSON.stringify(qi)),p(M,"id","load-different-stable-diffusion-formats"),p(M,"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"),p(M,"href","#load-different-stable-diffusion-formats"),p(d,"class","relative group"),p(at,"href","schedulers"),p(it,"href","write_own_pipeline"),p(nt,"href","./optimization/opt_overview"),p(O,"id","pytorch-ckpt"),p(O,"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"),p(O,"href","#pytorch-ckpt"),p(Y,"class","relative group"),p(pt,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.from_ckpt"),p(K,"id","convert-with-a-space"),p(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"),p(K,"href","#convert-with-a-space"),p(X,"class","relative group"),p(we,"href","https://huggingface.co/spaces/diffusers/sd-to-diffusers"),p(we,"rel","nofollow"),p(te,"id","convert-with-a-script"),p(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"),p(te,"href","#convert-with-a-script"),p(H,"class","relative group"),p(_e,"href","https://github.com/huggingface/diffusers/blob/main/scripts/convert_original_stable_diffusion_to_diffusers.py"),p(_e,"rel","nofollow"),p(ke,"href","https://huggingface.co/CiaraRowles/TemporalNet"),p(ke,"rel","nofollow"),p(Te,"start","2"),p(Ue,"href","https://github.com/lllyasviel/ControlNet/tree/main/models"),p(Ue,"rel","nofollow"),p(P,"start","3"),p(je,"href","https://huggingface.co/CiaraRowles/TemporalNet/discussions/13"),p(je,"rel","nofollow"),p(Ge,"start","5"),p(re,"id","keras-pb-or-h5"),p(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"),p(re,"href","#keras-pb-or-h5"),p(F,"class","relative group"),p(Be,"href","https://keras.io/keras_cv/"),p(Be,"rel","nofollow"),p(Ae,"href","https://github.com/keras-team/keras-cv/blob/master/keras_cv/models/stable_diffusion"),p(Ae,"rel","nofollow"),p(De,"href","https://huggingface.co/docs/diffusers/using-diffusers/schedulers"),p(De,"rel","nofollow"),p(Ne,"href","https://huggingface.co/docs/diffusers/optimization/xformers"),p(Ne,"rel","nofollow"),p(Re,"href","https://huggingface.co/docs/diffusers/optimization/fp16"),p(Re,"rel","nofollow"),p(Ve,"href","https://huggingface.co/spaces/sayakpaul/convert-kerascv-sd-diffusers"),p(Ve,"rel","nofollow"),p(mt,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),p(xe,"href","https://huggingface.co/sayakpaul/textual-inversion-kerasio/tree/main"),p(xe,"rel","nofollow"),p(ne,"id","a1111-lora-files"),p(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"),p(ne,"href","#a1111-lora-files"),p(Q,"class","relative group"),p(Le,"href","https://github.com/AUTOMATIC1111/stable-diffusion-webui"),p(Le,"rel","nofollow"),p(ze,"href","https://civitai.com/"),p(ze,"rel","nofollow"),p(wt,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights"),p(Qe,"href","https://civitai.com/models/14605?modelVersionId=19998"),p(Qe,"rel","nofollow"),p(bt,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights"),Pi(bo.src,pa="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/a1111-lora-sf.png")||p(bo,"src",pa),p(tt,"class","flex justify-center")},m(e,n){t(document.head,u),f(e,U,n),f(e,d,n),t(d,M),t(M,R),v(g,R,null),t(d,me),t(d,V),t(V,x),f(e,$,n),f(e,J,n),t(J,st),t(J,at),t(at,Gl),t(J,Il),t(J,it),t(it,jl),t(J,Sl),t(J,nt),t(nt,Wl),t(J,Bl),f(e,Jo,n),v(q,e,n),f(e,To,n),f(e,ft,n),t(ft,Al),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f(e,vt,n),t(vt,Ps),f(e,tl,n),v(He,e,n),f(e,ol,n),f(e,Q,n),t(Q,ne),t(ne,vo),v(Pe,vo,null),t(Q,Ls),t(Q,wo),t(wo,zs),f(e,ll,n),f(e,S,n),t(S,Le),t(Le,Fs),t(S,Qs),t(S,ze),t(ze,qs),t(S,Os),t(S,wt),t(wt,Ks),t(S,ea),f(e,rl,n),v(Fe,e,n),f(e,sl,n),f(e,fe,n),t(fe,ta),t(fe,Qe),t(Qe,oa),t(fe,la),f(e,al,n),v(qe,e,n),f(e,il,n),f(e,pe,n),t(pe,ra),t(pe,bt),t(bt,sa),t(pe,aa),f(e,nl,n),v(Oe,e,n),f(e,fl,n),f(e,_t,n),t(_t,ia),f(e,pl,n),v(Ke,e,n),f(e,cl,n),f(e,Mt,n),t(Mt,na),f(e,hl,n),v(et,e,n),f(e,ul,n),f(e,tt,n),t(tt,bo),dl=!0},p(e,[n]){const ot={};n&2&&(ot.$$scope={dirty:n,ctx:e}),q.$set(ot);const _o={};n&2&&(_o.$$scope={dirty:n,ctx:e}),se.$set(_o)},i(e){dl||(w(g.$$.fragment,e),w(q.$$.fragment,e),w(ye.$$.fragment,e),w(ve.$$.fragment,e),w(be.$$.fragment,e),w(Me.$$.fragment,e),w(Je.$$.fragment,e),w(ge.$$.fragment,e),w(Ze.$$.fragment,e),w(Se.$$.fragment,e),w(We.$$.fragment,e),w(se.$$.fragment,e),w(Xe.$$.fragment,e),w(He.$$.fragment,e),w(Pe.$$.fragment,e),w(Fe.$$.fragment,e),w(qe.$$.fragment,e),w(Oe.$$.fragment,e),w(Ke.$$.fragment,e),w(et.$$.fragment,e),dl=!0)},o(e){b(g.$$.fragment,e),b(q.$$.fragment,e),b(ye.$$.fragment,e),b(ve.$$.fragment,e),b(be.$$.fragment,e),b(Me.$$.fragment,e),b(Je.$$.fragment,e),b(ge.$$.fragment,e),b(Ze.$$.fragment,e),b(Se.$$.fragment,e),b(We.$$.fragment,e),b(se.$$.fragment,e),b(Xe.$$.fragment,e),b(He.$$.fragment,e),b(Pe.$$.fragment,e),b(Fe.$$.fragment,e),b(qe.$$.fragment,e),b(Oe.$$.fragment,e),b(Ke.$$.fragment,e),b(et.$$.fragment,e),dl=!1},d(e){o(u),e&&o(U),e&&o(d),_(g),e&&o($),e&&o(J),e&&o(Jo),_(q,e),e&&o(To),e&&o(ft),e&&o(go),e&&o(Y),_(ye),e&&o(Eo),e&&o(k),e&&o($o),e&&o(B),e&&o(Uo),e&&o(X),_(ve),e&&o(Co),e&&o(C),e&&o(Zo),e&&o(ee),e&&o(Go),e&&o(H),_(be),e&&o(Io),e&&o(A),e&&o(jo),e&&o(ct),e&&o(So),_(Me,e),e&&o(Wo),e&&o(ht),e&&o(Bo),e&&o(ut),e&&o(Ao),_(Je,e),e&&o(Do),e&&o(Te),e&&o(No),_(ge,e),e&&o(Ro),e&&o(P),e&&o(Vo),_(Ze,e),e&&o(xo),e&&o(Ge),e&&o(Yo),_(Se,e),e&&o(Xo),e&&o(F),_(We),e&&o(Ho),_(se,e),e&&o(Po),e&&o(T),e&&o(Lo),e&&o(E),e&&o(zo),e&&o(D),e&&o(Fo),e&&o(yt),e&&o(Qo),e&&o(Z),e&&o(qo),e&&o(ae),e&&o(Oo),e&&o(ie),e&&o(Ko),_(Xe,e),e&&o(el),e&&o(vt),e&&o(tl),_(He,e),e&&o(ol),e&&o(Q),_(Pe),e&&o(ll),e&&o(S),e&&o(rl),_(Fe,e),e&&o(sl),e&&o(fe),e&&o(al),_(qe,e),e&&o(il),e&&o(pe),e&&o(nl),_(Oe,e),e&&o(fl),e&&o(_t),e&&o(pl),_(Ke,e),e&&o(cl),e&&o(Mt),e&&o(hl),_(et,e),e&&o(ul),e&&o(tt)}}}const qi={local:"load-different-stable-diffusion-formats",sections:[{local:"pytorch-ckpt",sections:[{local:"convert-with-a-space",title:"Convert with a Space"},{local:"convert-with-a-script",title:"Convert with a script"}],title:"PyTorch .ckpt"},{local:"keras-pb-or-h5",title:"Keras .pb or .h5"},{local:"a1111-lora-files",title:"A1111 LoRA files"}],title:"Load different Stable Diffusion formats"};function Oi(rt){return Li(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ln extends xi{constructor(u){super();Yi(this,u,Oi,Qi,Xi,{})}}export{ln as default,qi as metadata};
