import{S as Yi,i as Pi,s as Hi,e as s,k as c,w as m,t as l,M as Li,c as a,d as o,m as h,a as i,x as y,h as r,b as p,N as zi,G as t,g as f,y as v,q as w,o as b,B as _,v as Fi}from"../../chunks/vendor-hf-doc-builder.js";import{T as xi}from"../../chunks/Tip-hf-doc-builder.js";import{I as Zt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as I}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as Qi}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function qi(at){let u,M,d,g,A,J,ye,X;return{c(){u=s("p"),M=l("We highly recommend using the "),d=s("code"),g=l(".safetensors"),A=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 "),J=s("a"),ye=l("Load safetensors"),X=l(" guide)."),this.h()},l(x){u=a(x,"P",{});var E=i(u);M=r(E,"We highly recommend using the "),d=a(E,"CODE",{});var W=i(d);g=r(W,".safetensors"),W.forEach(o),A=r(E," 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 "),J=a(E,"A",{href:!0});var ve=i(J);ye=r(ve,"Load safetensors"),ve.forEach(o),X=r(E," guide)."),E.forEach(o),this.h()},h(){p(J,"href","using_safetensors")},m(x,E){f(x,u,E),t(u,M),t(u,d),t(d,g),t(u,A),t(u,J),t(J,ye),t(u,X)},d(x){x&&o(u)}}}function Oi(at){let u,M;return{c(){u=s("p"),M=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 g=i(u);M=r(g,"\u{1F9EA} This is an experimental feature. Only Stable Diffusion v1 checkpoints are supported by the Convert KerasCV Space at the moment."),g.forEach(o)},m(d,g){f(d,u,g),t(u,M)},d(d){d&&o(u)}}}function Ki(at){let u,M,d,g,A,J,ye,X,x,E,W,ve,Z,Il,it,Sl,Nl,nt,Dl,Wl,ft,Bl,Vl,Jo,O,$o,pt,jl,Eo,Y,K,Ut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huggingface/notebooks/blob/main/diffusers_doc/en/other-formats.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/other-formats.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/other-formats.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/other-formats.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/other-formats.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/other-formats.ipynb"}]}}),O=new xi({props:{$$slots:{default:[qi]},$$scope:{ctx:at}}}),we=new Zt({}),be=new Zt({}),ge=new Zt({}),Te=new I({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:"huggingface-cli login"}}),$e=new I({props:{code:"Z2l0JTIwbGZzJTIwaW5zdGFsbCUwQWdpdCUyMGNsb25lJTIwaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRkNpYXJhUm93bGVzJTJGVGVtcG9yYWxOZXQ=",highlighted:`git lfs install
git <span class="hljs-built_in">clone</span> https://huggingface.co/CiaraRowles/TemporalNet`}}),Me=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`}}),Ie=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"}}),We=new I({props:{code:"Z2l0JTIwcHVzaCUyMG9yaWdpbiUyMHByJTJGMTMlM0FyZWZzJTJGcHIlMkYxMw==",highlighted:'git push origin <span class="hljs-built_in">pr</span>/13:refs/pr/13'}}),Be=new Zt({}),ae=new xi({props:{warning:!0,$$slots:{default:[Oi]},$$scope:{ctx:at}}}),He=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc2F5YWtwYXVsJTJGdGV4dHVhbC1pbnZlcnNpb24tY2F0LWtlcmFzY3Zfc2RfZGlmZnVzZXJzX3BpcGVsaW5lJTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSk=",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>, use_safetensors=<span class="hljs-literal">True</span>
)`}}),Le=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc2F5YWtwYXVsJTJGdGV4dHVhbC1pbnZlcnNpb24tY2F0LWtlcmFzY3Zfc2RfZGlmZnVzZXJzX3BpcGVsaW5lJTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSklMEFwaXBlbGluZS50byglMjJjdWRhJTIyKSUwQSUwQXBsYWNlaG9sZGVyX3Rva2VuJTIwJTNEJTIwJTIyJTNDbXktZnVubnktY2F0LXRva2VuJTNFJTIyJTBBcHJvbXB0JTIwJTNEJTIwZiUyMnR3byUyMCU3QnBsYWNlaG9sZGVyX3Rva2VuJTdEJTIwZ2V0dGluZyUyMG1hcnJpZWQlMkMlMjBwaG90b3JlYWxpc3RpYyUyQyUyMGhpZ2glMjBxdWFsaXR5JTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQ=",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>, use_safetensors=<span class="hljs-literal">True</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>]`}}),ze=new Zt({}),qe=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)`}}),Ke=new I({props:{code:"JTIzJTIwdW5jb21tZW50JTIwdG8lMjBkb3dubG9hZCUyMHRoZSUyMHNhZmV0ZW5zb3IlMjB3ZWlnaHRzJTBBJTIzIXdnZXQlMjBodHRwcyUzQSUyRiUyRmNpdml0YWkuY29tJTJGYXBpJTJGZG93bmxvYWQlMkZtb2RlbHMlMkYxOTk5OCUyMC1PJTIwaG93bHNfbW92aW5nX2Nhc3RsZS5zYWZldGVuc29ycw==",highlighted:`<span class="hljs-comment"># uncomment to download the safetensor weights</span>
<span class="hljs-comment">#!wget https://civitai.com/api/download/models/19998 -O howls_moving_castle.safetensors</span>`}}),et=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>)'}}),tt=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`}}),ot=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUwQSUwQW1ha2VfaW1hZ2VfZ3JpZChpbWFnZXMlMkMlMjAyJTJDJTIwMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid

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