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