import{S as so,i as lo,s as to,e as r,k as u,w as c,t as o,M as oo,c as n,d as s,m as h,a as i,x as b,h as a,b as f,G as l,g as p,y as d,L as ao,q as m,o as y,B as M,v as ro}from"../../chunks/vendor-hf-doc-builder.js";import{I as Oe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as T}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as no}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function io(ft){let E,es,k,V,Ge,P,Qs,Ve,zs,ss,Q,ls,w,qs,he,Fs,Ls,fe,Ks,Os,ts,_,Ce,el,sl,De,ll,tl,Ne,ol,os,C,al,ce,rl,nl,as,D,il,z,pl,ul,rs,q,ns,Z,N,We,F,hl,Re,fl,is,W,cl,be,bl,dl,ps,L,us,v,ml,de,Xe,yl,Ml,Ae,Jl,Tl,hs,K,fs,J,wl,me,_l,vl,ge,jl,Il,He,Ul,El,cs,ye,kl,bs,O,ds,$,R,Se,ee,Zl,Ye,$l,ms,X,Bl,Me,Gl,Vl,ys,se,Ms,j,Cl,Je,Dl,Nl,xe,Wl,Rl,Js,Te,Xl,Ts,le,ws,B,A,Pe,te,Al,Qe,gl,_s,g,Hl,we,Sl,Yl,vs,oe,js,I,xl,_e,Pl,Ql,ve,zl,ql,Is,ae,Us,H,Fl,je,Ll,Kl,Es,re,ks,G,S,ze,ne,Ol,qe,et,Zs,U,st,Fe,lt,tt,Ie,ot,at,$s,ie,Bs,pe,rt,Le,nt,Gs,Y,it,Ke,pt,ut,Vs,ue,Cs;return P=new Oe({}),Q=new no({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/push_to_hub.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/push_to_hub.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/push_to_hub.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/push_to_hub.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/push_to_hub.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/push_to_hub.ipynb"}]}}),q=new T({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

notebook_login()`}}),F=new Oe({}),L=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvbnRyb2xOZXRNb2RlbCUwQSUwQWNvbnRyb2xuZXQlMjAlM0QlMjBDb250cm9sTmV0TW9kZWwoJTBBJTIwJTIwJTIwJTIwYmxvY2tfb3V0X2NoYW5uZWxzJTNEKDMyJTJDJTIwNjQpJTJDJTBBJTIwJTIwJTIwJTIwbGF5ZXJzX3Blcl9ibG9jayUzRDIlMkMlMEElMjAlMjAlMjAlMjBpbl9jaGFubmVscyUzRDQlMkMlMEElMjAlMjAlMjAlMjBkb3duX2Jsb2NrX3R5cGVzJTNEKCUyMkRvd25CbG9jazJEJTIyJTJDJTIwJTIyQ3Jvc3NBdHRuRG93bkJsb2NrMkQlMjIpJTJDJTBBJTIwJTIwJTIwJTIwY3Jvc3NfYXR0ZW50aW9uX2RpbSUzRDMyJTJDJTBBJTIwJTIwJTIwJTIwY29uZGl0aW9uaW5nX2VtYmVkZGluZ19vdXRfY2hhbm5lbHMlM0QoMTYlMkMlMjAzMiklMkMlMEEpJTBBY29udHJvbG5ldC5wdXNoX3RvX2h1YiglMjJteS1jb250cm9sbmV0LW1vZGVsJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ControlNetModel

controlnet = ControlNetModel(
    block_out_channels=(<span class="hljs-number">32</span>, <span class="hljs-number">64</span>),
    layers_per_block=<span class="hljs-number">2</span>,
    in_channels=<span class="hljs-number">4</span>,
    down_block_types=(<span class="hljs-string">&quot;DownBlock2D&quot;</span>, <span class="hljs-string">&quot;CrossAttnDownBlock2D&quot;</span>),
    cross_attention_dim=<span class="hljs-number">32</span>,
    conditioning_embedding_out_channels=(<span class="hljs-number">16</span>, <span class="hljs-number">32</span>),
)
controlnet.push_to_hub(<span class="hljs-string">&quot;my-controlnet-model&quot;</span>)`}}),K=new T({props:{code:"Y29udHJvbG5ldC5wdXNoX3RvX2h1YiglMjJteS1jb250cm9sbmV0LW1vZGVsJTIyJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIp",highlighted:'controlnet.push_to_hub(<span class="hljs-string">&quot;my-controlnet-model&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>)'}}),O=new T({props:{code:"bW9kZWwlMjAlM0QlMjBDb250cm9sTmV0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnlvdXItbmFtZXNwYWNlJTJGbXktY29udHJvbG5ldC1tb2RlbCUyMik=",highlighted:'model = ControlNetModel.from_pretrained(<span class="hljs-string">&quot;your-namespace/my-controlnet-model&quot;</span>)'}}),ee=new Oe({}),se=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERESU1TY2hlZHVsZXIlMEElMEFzY2hlZHVsZXIlMjAlM0QlMjBERElNU2NoZWR1bGVyKCUwQSUyMCUyMCUyMCUyMGJldGFfc3RhcnQlM0QwLjAwMDg1JTJDJTBBJTIwJTIwJTIwJTIwYmV0YV9lbmQlM0QwLjAxMiUyQyUwQSUyMCUyMCUyMCUyMGJldGFfc2NoZWR1bGUlM0QlMjJzY2FsZWRfbGluZWFyJTIyJTJDJTBBJTIwJTIwJTIwJTIwY2xpcF9zYW1wbGUlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMHNldF9hbHBoYV90b19vbmUlM0RGYWxzZSUyQyUwQSklMEFzY2hlZHVsZXIucHVzaF90b19odWIoJTIybXktY29udHJvbG5ldC1zY2hlZHVsZXIlMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDIMScheduler

scheduler = DDIMScheduler(
    beta_start=<span class="hljs-number">0.00085</span>,
    beta_end=<span class="hljs-number">0.012</span>,
    beta_schedule=<span class="hljs-string">&quot;scaled_linear&quot;</span>,
    clip_sample=<span class="hljs-literal">False</span>,
    set_alpha_to_one=<span class="hljs-literal">False</span>,
)
scheduler.push_to_hub(<span class="hljs-string">&quot;my-controlnet-scheduler&quot;</span>)`}}),le=new T({props:{code:"c2NoZWR1bGVyJTIwJTNEJTIwRERJTVNjaGVkdWxlci5mcm9tX3ByZXRyYWluZWQoJTIyeW91ci1uYW1lcHNhY2UlMkZteS1jb250cm9sbmV0LXNjaGVkdWxlciUyMik=",highlighted:'scheduler = DDIMScheduler.from_pretrained(<span class="hljs-string">&quot;your-namepsace/my-controlnet-scheduler&quot;</span>)'}}),te=new Oe({}),oe=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBVTmV0MkRDb25kaXRpb25Nb2RlbCUyQyUwQSUyMCUyMCUyMCUyMEF1dG9lbmNvZGVyS0wlMkMlMEElMjAlMjAlMjAlMjBERElNU2NoZWR1bGVyJTJDJTBBJTIwJTIwJTIwJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMkMlMEEpJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBUZXh0TW9kZWwlMkMlMjBDTElQVGV4dENvbmZpZyUyQyUyMENMSVBUb2tlbml6ZXIlMEElMEF1bmV0JTIwJTNEJTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwoJTBBJTIwJTIwJ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<span class="hljs-keyword">import</span> (
    UNet2DConditionModel,
    AutoencoderKL,
    DDIMScheduler,
    StableDiffusionPipeline,
)
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPTextModel, CLIPTextConfig, CLIPTokenizer

unet = UNet2DConditionModel(
    block_out_channels=(<span class="hljs-number">32</span>, <span class="hljs-number">64</span>),
    layers_per_block=<span class="hljs-number">2</span>,
    sample_size=<span class="hljs-number">32</span>,
    in_channels=<span class="hljs-number">4</span>,
    out_channels=<span class="hljs-number">4</span>,
    down_block_types=(<span class="hljs-string">&quot;DownBlock2D&quot;</span>, <span class="hljs-string">&quot;CrossAttnDownBlock2D&quot;</span>),
    up_block_types=(<span class="hljs-string">&quot;CrossAttnUpBlock2D&quot;</span>, <span class="hljs-string">&quot;UpBlock2D&quot;</span>),
    cross_attention_dim=<span class="hljs-number">32</span>,
)

scheduler = DDIMScheduler(
    beta_start=<span class="hljs-number">0.00085</span>,
    beta_end=<span class="hljs-number">0.012</span>,
    beta_schedule=<span class="hljs-string">&quot;scaled_linear&quot;</span>,
    clip_sample=<span class="hljs-literal">False</span>,
    set_alpha_to_one=<span class="hljs-literal">False</span>,
)

vae = AutoencoderKL(
    block_out_channels=[<span class="hljs-number">32</span>, <span class="hljs-number">64</span>],
    in_channels=<span class="hljs-number">3</span>,
    out_channels=<span class="hljs-number">3</span>,
    down_block_types=[<span class="hljs-string">&quot;DownEncoderBlock2D&quot;</span>, <span class="hljs-string">&quot;DownEncoderBlock2D&quot;</span>],
    up_block_types=[<span class="hljs-string">&quot;UpDecoderBlock2D&quot;</span>, <span class="hljs-string">&quot;UpDecoderBlock2D&quot;</span>],
    latent_channels=<span class="hljs-number">4</span>,
)

text_encoder_config = CLIPTextConfig(
    bos_token_id=<span class="hljs-number">0</span>,
    eos_token_id=<span class="hljs-number">2</span>,
    hidden_size=<span class="hljs-number">32</span>,
    intermediate_size=<span class="hljs-number">37</span>,
    layer_norm_eps=<span class="hljs-number">1e-05</span>,
    num_attention_heads=<span class="hljs-number">4</span>,
    num_hidden_layers=<span class="hljs-number">5</span>,
    pad_token_id=<span class="hljs-number">1</span>,
    vocab_size=<span class="hljs-number">1000</span>,
)
text_encoder = CLIPTextModel(text_encoder_config)
tokenizer = CLIPTokenizer.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-clip&quot;</span>)`}}),ae=new T({props:{code:"Y29tcG9uZW50cyUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnVuZXQlMjIlM0ElMjB1bmV0JTJDJTBBJTIwJTIwJTIwJTIwJTIyc2NoZWR1bGVyJTIyJTNBJTIwc2NoZWR1bGVyJTJDJTBBJTIwJTIwJTIwJTIwJTIydmFlJTIyJTNBJTIwdmFlJTJDJTBBJTIwJTIwJTIwJTIwJTIydGV4dF9lbmNvZGVyJTIyJTNBJTIwdGV4dF9lbmNvZGVyJTJDJTBBJTIwJTIwJTIwJTIwJTIydG9rZW5pemVyJTIyJTNBJTIwdG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwJTIyc2FmZXR5X2NoZWNrZXIlMjIlM0ElMjBOb25lJTJDJTBBJTIwJTIwJTIwJTIwJTIyZmVhdHVyZV9leHRyYWN0b3IlMjIlM0ElMjBOb25lJTJDJTBBJTdEJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25QaXBlbGluZSgqKmNvbXBvbmVudHMpJTBBcGlwZWxpbmUucHVzaF90b19odWIoJTIybXktcGlwZWxpbmUlMjIp",highlighted:`components = {
    <span class="hljs-string">&quot;unet&quot;</span>: unet,
    <span class="hljs-string">&quot;scheduler&quot;</span>: scheduler,
    <span class="hljs-string">&quot;vae&quot;</span>: vae,
    <span class="hljs-string">&quot;text_encoder&quot;</span>: text_encoder,
    <span class="hljs-string">&quot;tokenizer&quot;</span>: tokenizer,
    <span class="hljs-string">&quot;safety_checker&quot;</span>: <span class="hljs-literal">None</span>,
    <span class="hljs-string">&quot;feature_extractor&quot;</span>: <span class="hljs-literal">None</span>,
}

pipeline = StableDiffusionPipeline(**components)
pipeline.push_to_hub(<span class="hljs-string">&quot;my-pipeline&quot;</span>)`}}),re=new T({props:{code:"cGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyeW91ci1uYW1lc3BhY2UlMkZteS1waXBlbGluZSUyMik=",highlighted:'pipeline = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;your-namespace/my-pipeline&quot;</span>)'}}),ne=new Oe({}),ie=new T({props:{code:"Y29udHJvbG5ldC5wdXNoX3RvX2h1YiglMjJteS1jb250cm9sbmV0LW1vZGVsJTIyJTJDJTIwcHJpdmF0ZSUzRFRydWUp",highlighted:'controlnet.push_to_hub(<span class="hljs-string">&quot;my-controlnet-model&quot;</span>, private=<span class="hljs-literal">True</span>)'}}),ue=new T({props:{code:"bW9kZWwlMjAlM0QlMjBDb250cm9sTmV0LmZyb21fcHJldHJhaW5lZCglMjJ5b3VyLW5hbWVzcGFjZSUyRm15LWNvbnRyb2xuZXQtbW9kZWwlMjIlMkMlMjB1c2VfYXV0aF90b2tlbiUzRFRydWUp",highlighted:'model = ControlNet.from_pretrained(<span class="hljs-string">&quot;your-namespace/my-controlnet-model&quot;</span>, use_auth_token=<span class="hljs-literal">True</span>)'}}),{c(){E=r("meta"),es=u(),k=r("h1"),V=r("a"),Ge=r("span"),c(P.$$.fragment),Qs=u(),Ve=r("span"),zs=o("Push files to the Hub"),ss=u(),c(Q.$$.fragment),ls=u(),w=r("p"),qs=o("\u{1F917} Diffusers provides a "),he=r("a"),Fs=o("PushToHubMixin"),Ls=o(" for uploading your model, scheduler, or pipeline to the Hub. It is an easy way to store your files on the Hub, and also allows you to share your work with others. Under the hood, the "),fe=r("a"),Ks=o("PushToHubMixin"),Os=o(":"),ts=u(),_=r("ol"),Ce=r("li"),el=o("creates a repository on the Hub"),sl=u(),De=r("li"),ll=o("saves your model, scheduler, or pipeline files so they can be reloaded later"),tl=u(),Ne=r("li"),ol=o("uploads folder containing these files to the Hub"),os=u(),C=r("p"),al=o("This guide will show you how to use the "),ce=r("a"),rl=o("PushToHubMixin"),nl=o(" to upload your files to the Hub."),as=u(),D=r("p"),il=o("You\u2019ll need to log in to your Hub account with your access "),z=r("a"),pl=o("token"),ul=o(" first:"),rs=u(),c(q.$$.fragment),ns=u(),Z=r("h2"),N=r("a"),We=r("span"),c(F.$$.fragment),hl=u(),Re=r("span"),fl=o("Models"),is=u(),W=r("p"),cl=o("To push a model to the Hub, call "),be=r("a"),bl=o("push_to_hub()"),dl=o(" and specfiy the repository id of the model to be stored on the Hub:"),ps=u(),c(L.$$.fragment),us=u(),v=r("p"),ml=o("For model\u2019s, you can also specify the "),de=r("a"),Xe=r("em"),yl=o("variant"),Ml=o(" of the weights to push to the Hub. For example, to push "),Ae=r("code"),Jl=o("fp16"),Tl=o(" weights:"),hs=u(),c(K.$$.fragment),fs=u(),J=r("p"),wl=o("The "),me=r("a"),_l=o("push_to_hub()"),vl=o(" function saves the model\u2019s "),ge=r("code"),jl=o("config.json"),Il=o(" file and the weights are automatically saved in the "),He=r("code"),Ul=o("safetensors"),El=o(" format."),cs=u(),ye=r("p"),kl=o("Now you can reload the model from your repository on the Hub:"),bs=u(),c(O.$$.fragment),ds=u(),$=r("h2"),R=r("a"),Se=r("span"),c(ee.$$.fragment),Zl=u(),Ye=r("span"),$l=o("Scheduler"),ms=u(),X=r("p"),Bl=o("To push a scheduler to the Hub, call "),Me=r("a"),Gl=o("push_to_hub()"),Vl=o(" and specfiy the repository id of the scheduler to be stored on the Hub:"),ys=u(),c(se.$$.fragment),Ms=u(),j=r("p"),Cl=o("The "),Je=r("a"),Dl=o("push_to_hub()"),Nl=o(" function saves the scheduler\u2019s "),xe=r("code"),Wl=o("scheduler_config.json"),Rl=o(" file to the specified repository."),Js=u(),Te=r("p"),Xl=o("Now you can reload the scheduler from your repository on the Hub:"),Ts=u(),c(le.$$.fragment),ws=u(),B=r("h2"),A=r("a"),Pe=r("span"),c(te.$$.fragment),Al=u(),Qe=r("span"),gl=o("Pipeline"),_s=u(),g=r("p"),Hl=o("You can also push an entire pipeline with all it\u2019s components to the Hub. For example, initialize the components of a "),we=r("a"),Sl=o("StableDiffusionPipeline"),Yl=o(" with the parameters you want:"),vs=u(),c(oe.$$.fragment),js=u(),I=r("p"),xl=o("Pass all of the components to the "),_e=r("a"),Pl=o("StableDiffusionPipeline"),Ql=o(" and call "),ve=r("a"),zl=o("push_to_hub()"),ql=o(" to push the pipeline to the Hub:"),Is=u(),c(ae.$$.fragment),Us=u(),H=r("p"),Fl=o("The "),je=r("a"),Ll=o("push_to_hub()"),Kl=o(" function saves each component to a subfolder in the repository. Now you can reload the pipeline from your repository on the Hub:"),Es=u(),c(re.$$.fragment),ks=u(),G=r("h2"),S=r("a"),ze=r("span"),c(ne.$$.fragment),Ol=u(),qe=r("span"),et=o("Privacy"),Zs=u(),U=r("p"),st=o("Set "),Fe=r("code"),lt=o("private=True"),tt=o(" in the "),Ie=r("a"),ot=o("push_to_hub()"),at=o(" function to keep your model, scheduler, or pipeline files private:"),$s=u(),c(ie.$$.fragment),Bs=u(),pe=r("p"),rt=o("Private repositories are only visible to you, and other users won\u2019t be able to clone the repository and your repository won\u2019t appear in search results. Even if a user has the URL to your private repository, they\u2019ll receive a "),Le=r("code"),nt=o("404 - Repo not found error."),Gs=u(),Y=r("p"),it=o("To load a model, scheduler, or pipeline from a private or gated repositories, set "),Ke=r("code"),pt=o("use_auth_token=True"),ut=o(":"),Vs=u(),c(ue.$$.fragment),this.h()},l(e){const t=oo('[data-svelte="svelte-1phssyn"]',document.head);E=n(t,"META",{name:!0,content:!0}),t.forEach(s),es=h(e),k=n(e,"H1",{class:!0});var Ds=i(k);V=n(Ds,"A",{id:!0,class:!0,href:!0});var ct=i(V);Ge=n(ct,"SPAN",{});var bt=i(Ge);b(P.$$.fragment,bt),bt.forEach(s),ct.forEach(s),Qs=h(Ds),Ve=n(Ds,"SPAN",{});var dt=i(Ve);zs=a(dt,"Push files to the Hub"),dt.forEach(s),Ds.forEach(s),ss=h(e),b(Q.$$.fragment,e),ls=h(e),w=n(e,"P",{});var Ue=i(w);qs=a(Ue,"\u{1F917} Diffusers provides a "),he=n(Ue,"A",{href:!0});var mt=i(he);Fs=a(mt,"PushToHubMixin"),mt.forEach(s),Ls=a(Ue," for uploading your model, scheduler, or pipeline to the Hub. It is an easy way to store your files on the Hub, and also allows you to share your work with others. Under the hood, the "),fe=n(Ue,"A",{href:!0});var yt=i(fe);Ks=a(yt,"PushToHubMixin"),yt.forEach(s),Os=a(Ue,":"),Ue.forEach(s),ts=h(e),_=n(e,"OL",{});var Ee=i(_);Ce=n(Ee,"LI",{});var Mt=i(Ce);el=a(Mt,"creates a repository on the Hub"),Mt.forEach(s),sl=h(Ee),De=n(Ee,"LI",{});var Jt=i(De);ll=a(Jt,"saves your model, scheduler, or pipeline files so they can be reloaded later"),Jt.forEach(s),tl=h(Ee),Ne=n(Ee,"LI",{});var Tt=i(Ne);ol=a(Tt,"uploads folder containing these files to the Hub"),Tt.forEach(s),Ee.forEach(s),os=h(e),C=n(e,"P",{});var Ns=i(C);al=a(Ns,"This guide will show you how to use the "),ce=n(Ns,"A",{href:!0});var wt=i(ce);rl=a(wt,"PushToHubMixin"),wt.forEach(s),nl=a(Ns," to upload your files to the Hub."),Ns.forEach(s),as=h(e),D=n(e,"P",{});var Ws=i(D);il=a(Ws,"You\u2019ll need to log in to your Hub account with your access "),z=n(Ws,"A",{href:!0,rel:!0});var _t=i(z);pl=a(_t,"token"),_t.forEach(s),ul=a(Ws," first:"),Ws.forEach(s),rs=h(e),b(q.$$.fragment,e),ns=h(e),Z=n(e,"H2",{class:!0});var Rs=i(Z);N=n(Rs,"A",{id:!0,class:!0,href:!0});var vt=i(N);We=n(vt,"SPAN",{});var jt=i(We);b(F.$$.fragment,jt),jt.forEach(s),vt.forEach(s),hl=h(Rs),Re=n(Rs,"SPAN",{});var It=i(Re);fl=a(It,"Models"),It.forEach(s),Rs.forEach(s),is=h(e),W=n(e,"P",{});var Xs=i(W);cl=a(Xs,"To push a model to the Hub, call "),be=n(Xs,"A",{href:!0});var Ut=i(be);bl=a(Ut,"push_to_hub()"),Ut.forEach(s),dl=a(Xs," and specfiy the repository id of the model to be stored on the Hub:"),Xs.forEach(s),ps=h(e),b(L.$$.fragment,e),us=h(e),v=n(e,"P",{});var ke=i(v);ml=a(ke,"For model\u2019s, you can also specify the "),de=n(ke,"A",{href:!0});var Et=i(de);Xe=n(Et,"EM",{});var kt=i(Xe);yl=a(kt,"variant"),kt.forEach(s),Et.forEach(s),Ml=a(ke," of the weights to push to the Hub. For example, to push "),Ae=n(ke,"CODE",{});var Zt=i(Ae);Jl=a(Zt,"fp16"),Zt.forEach(s),Tl=a(ke," weights:"),ke.forEach(s),hs=h(e),b(K.$$.fragment,e),fs=h(e),J=n(e,"P",{});var x=i(J);wl=a(x,"The "),me=n(x,"A",{href:!0});var $t=i(me);_l=a($t,"push_to_hub()"),$t.forEach(s),vl=a(x," function saves the model\u2019s "),ge=n(x,"CODE",{});var Bt=i(ge);jl=a(Bt,"config.json"),Bt.forEach(s),Il=a(x," file and the weights are automatically saved in the "),He=n(x,"CODE",{});var Gt=i(He);Ul=a(Gt,"safetensors"),Gt.forEach(s),El=a(x," format."),x.forEach(s),cs=h(e),ye=n(e,"P",{});var Vt=i(ye);kl=a(Vt,"Now you can reload the model from your repository on the Hub:"),Vt.forEach(s),bs=h(e),b(O.$$.fragment,e),ds=h(e),$=n(e,"H2",{class:!0});var As=i($);R=n(As,"A",{id:!0,class:!0,href:!0});var Ct=i(R);Se=n(Ct,"SPAN",{});var Dt=i(Se);b(ee.$$.fragment,Dt),Dt.forEach(s),Ct.forEach(s),Zl=h(As),Ye=n(As,"SPAN",{});var Nt=i(Ye);$l=a(Nt,"Scheduler"),Nt.forEach(s),As.forEach(s),ms=h(e),X=n(e,"P",{});var gs=i(X);Bl=a(gs,"To push a scheduler to the Hub, call "),Me=n(gs,"A",{href:!0});var Wt=i(Me);Gl=a(Wt,"push_to_hub()"),Wt.forEach(s),Vl=a(gs," and specfiy the repository id of the scheduler to be stored on the Hub:"),gs.forEach(s),ys=h(e),b(se.$$.fragment,e),Ms=h(e),j=n(e,"P",{});var Ze=i(j);Cl=a(Ze,"The "),Je=n(Ze,"A",{href:!0});var Rt=i(Je);Dl=a(Rt,"push_to_hub()"),Rt.forEach(s),Nl=a(Ze," function saves the scheduler\u2019s "),xe=n(Ze,"CODE",{});var Xt=i(xe);Wl=a(Xt,"scheduler_config.json"),Xt.forEach(s),Rl=a(Ze," file to the specified repository."),Ze.forEach(s),Js=h(e),Te=n(e,"P",{});var At=i(Te);Xl=a(At,"Now you can reload the scheduler from your repository on the Hub:"),At.forEach(s),Ts=h(e),b(le.$$.fragment,e),ws=h(e),B=n(e,"H2",{class:!0});var Hs=i(B);A=n(Hs,"A",{id:!0,class:!0,href:!0});var gt=i(A);Pe=n(gt,"SPAN",{});var Ht=i(Pe);b(te.$$.fragment,Ht),Ht.forEach(s),gt.forEach(s),Al=h(Hs),Qe=n(Hs,"SPAN",{});var St=i(Qe);gl=a(St,"Pipeline"),St.forEach(s),Hs.forEach(s),_s=h(e),g=n(e,"P",{});var Ss=i(g);Hl=a(Ss,"You can also push an entire pipeline with all it\u2019s components to the Hub. For example, initialize the components of a "),we=n(Ss,"A",{href:!0});var Yt=i(we);Sl=a(Yt,"StableDiffusionPipeline"),Yt.forEach(s),Yl=a(Ss," with the parameters you want:"),Ss.forEach(s),vs=h(e),b(oe.$$.fragment,e),js=h(e),I=n(e,"P",{});var $e=i(I);xl=a($e,"Pass all of the components to the "),_e=n($e,"A",{href:!0});var xt=i(_e);Pl=a(xt,"StableDiffusionPipeline"),xt.forEach(s),Ql=a($e," and call "),ve=n($e,"A",{href:!0});var Pt=i(ve);zl=a(Pt,"push_to_hub()"),Pt.forEach(s),ql=a($e," to push the pipeline to the Hub:"),$e.forEach(s),Is=h(e),b(ae.$$.fragment,e),Us=h(e),H=n(e,"P",{});var Ys=i(H);Fl=a(Ys,"The "),je=n(Ys,"A",{href:!0});var Qt=i(je);Ll=a(Qt,"push_to_hub()"),Qt.forEach(s),Kl=a(Ys," function saves each component to a subfolder in the repository. Now you can reload the pipeline from your repository on the Hub:"),Ys.forEach(s),Es=h(e),b(re.$$.fragment,e),ks=h(e),G=n(e,"H2",{class:!0});var xs=i(G);S=n(xs,"A",{id:!0,class:!0,href:!0});var zt=i(S);ze=n(zt,"SPAN",{});var qt=i(ze);b(ne.$$.fragment,qt),qt.forEach(s),zt.forEach(s),Ol=h(xs),qe=n(xs,"SPAN",{});var Ft=i(qe);et=a(Ft,"Privacy"),Ft.forEach(s),xs.forEach(s),Zs=h(e),U=n(e,"P",{});var Be=i(U);st=a(Be,"Set "),Fe=n(Be,"CODE",{});var Lt=i(Fe);lt=a(Lt,"private=True"),Lt.forEach(s),tt=a(Be," in the "),Ie=n(Be,"A",{href:!0});var Kt=i(Ie);ot=a(Kt,"push_to_hub()"),Kt.forEach(s),at=a(Be," function to keep your model, scheduler, or pipeline files private:"),Be.forEach(s),$s=h(e),b(ie.$$.fragment,e),Bs=h(e),pe=n(e,"P",{});var ht=i(pe);rt=a(ht,"Private repositories are only visible to you, and other users won\u2019t be able to clone the repository and your repository won\u2019t appear in search results. Even if a user has the URL to your private repository, they\u2019ll receive a "),Le=n(ht,"CODE",{});var Ot=i(Le);nt=a(Ot,"404 - Repo not found error."),Ot.forEach(s),ht.forEach(s),Gs=h(e),Y=n(e,"P",{});var Ps=i(Y);it=a(Ps,"To load a model, scheduler, or pipeline from a private or gated repositories, set "),Ke=n(Ps,"CODE",{});var eo=i(Ke);pt=a(eo,"use_auth_token=True"),eo.forEach(s),ut=a(Ps,":"),Ps.forEach(s),Vs=h(e),b(ue.$$.fragment,e),this.h()},h(){f(E,"name","hf:doc:metadata"),f(E,"content",JSON.stringify(po)),f(V,"id","push-files-to-the-hub"),f(V,"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"),f(V,"href","#push-files-to-the-hub"),f(k,"class","relative group"),f(he,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin"),f(fe,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin"),f(ce,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin"),f(z,"href","https://huggingface.co/settings/tokens"),f(z,"rel","nofollow"),f(N,"id","models"),f(N,"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"),f(N,"href","#models"),f(Z,"class","relative group"),f(be,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub"),f(de,"href","loading#checkpoint-variants"),f(me,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub"),f(R,"id","scheduler"),f(R,"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"),f(R,"href","#scheduler"),f($,"class","relative group"),f(Me,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub"),f(Je,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub"),f(A,"id","pipeline"),f(A,"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"),f(A,"href","#pipeline"),f(B,"class","relative group"),f(we,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),f(_e,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),f(ve,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub"),f(je,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub"),f(S,"id","privacy"),f(S,"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"),f(S,"href","#privacy"),f(G,"class","relative group"),f(Ie,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.utils.PushToHubMixin.push_to_hub")},m(e,t){l(document.head,E),p(e,es,t),p(e,k,t),l(k,V),l(V,Ge),d(P,Ge,null),l(k,Qs),l(k,Ve),l(Ve,zs),p(e,ss,t),d(Q,e,t),p(e,ls,t),p(e,w,t),l(w,qs),l(w,he),l(he,Fs),l(w,Ls),l(w,fe),l(fe,Ks),l(w,Os),p(e,ts,t),p(e,_,t),l(_,Ce),l(Ce,el),l(_,sl),l(_,De),l(De,ll),l(_,tl),l(_,Ne),l(Ne,ol),p(e,os,t),p(e,C,t),l(C,al),l(C,ce),l(ce,rl),l(C,nl),p(e,as,t),p(e,D,t),l(D,il),l(D,z),l(z,pl),l(D,ul),p(e,rs,t),d(q,e,t),p(e,ns,t),p(e,Z,t),l(Z,N),l(N,We),d(F,We,null),l(Z,hl),l(Z,Re),l(Re,fl),p(e,is,t),p(e,W,t),l(W,cl),l(W,be),l(be,bl),l(W,dl),p(e,ps,t),d(L,e,t),p(e,us,t),p(e,v,t),l(v,ml),l(v,de),l(de,Xe),l(Xe,yl),l(v,Ml),l(v,Ae),l(Ae,Jl),l(v,Tl),p(e,hs,t),d(K,e,t),p(e,fs,t),p(e,J,t),l(J,wl),l(J,me),l(me,_l),l(J,vl),l(J,ge),l(ge,jl),l(J,Il),l(J,He),l(He,Ul),l(J,El),p(e,cs,t),p(e,ye,t),l(ye,kl),p(e,bs,t),d(O,e,t),p(e,ds,t),p(e,$,t),l($,R),l(R,Se),d(ee,Se,null),l($,Zl),l($,Ye),l(Ye,$l),p(e,ms,t),p(e,X,t),l(X,Bl),l(X,Me),l(Me,Gl),l(X,Vl),p(e,ys,t),d(se,e,t),p(e,Ms,t),p(e,j,t),l(j,Cl),l(j,Je),l(Je,Dl),l(j,Nl),l(j,xe),l(xe,Wl),l(j,Rl),p(e,Js,t),p(e,Te,t),l(Te,Xl),p(e,Ts,t),d(le,e,t),p(e,ws,t),p(e,B,t),l(B,A),l(A,Pe),d(te,Pe,null),l(B,Al),l(B,Qe),l(Qe,gl),p(e,_s,t),p(e,g,t),l(g,Hl),l(g,we),l(we,Sl),l(g,Yl),p(e,vs,t),d(oe,e,t),p(e,js,t),p(e,I,t),l(I,xl),l(I,_e),l(_e,Pl),l(I,Ql),l(I,ve),l(ve,zl),l(I,ql),p(e,Is,t),d(ae,e,t),p(e,Us,t),p(e,H,t),l(H,Fl),l(H,je),l(je,Ll),l(H,Kl),p(e,Es,t),d(re,e,t),p(e,ks,t),p(e,G,t),l(G,S),l(S,ze),d(ne,ze,null),l(G,Ol),l(G,qe),l(qe,et),p(e,Zs,t),p(e,U,t),l(U,st),l(U,Fe),l(Fe,lt),l(U,tt),l(U,Ie),l(Ie,ot),l(U,at),p(e,$s,t),d(ie,e,t),p(e,Bs,t),p(e,pe,t),l(pe,rt),l(pe,Le),l(Le,nt),p(e,Gs,t),p(e,Y,t),l(Y,it),l(Y,Ke),l(Ke,pt),l(Y,ut),p(e,Vs,t),d(ue,e,t),Cs=!0},p:ao,i(e){Cs||(m(P.$$.fragment,e),m(Q.$$.fragment,e),m(q.$$.fragment,e),m(F.$$.fragment,e),m(L.$$.fragment,e),m(K.$$.fragment,e),m(O.$$.fragment,e),m(ee.$$.fragment,e),m(se.$$.fragment,e),m(le.$$.fragment,e),m(te.$$.fragment,e),m(oe.$$.fragment,e),m(ae.$$.fragment,e),m(re.$$.fragment,e),m(ne.$$.fragment,e),m(ie.$$.fragment,e),m(ue.$$.fragment,e),Cs=!0)},o(e){y(P.$$.fragment,e),y(Q.$$.fragment,e),y(q.$$.fragment,e),y(F.$$.fragment,e),y(L.$$.fragment,e),y(K.$$.fragment,e),y(O.$$.fragment,e),y(ee.$$.fragment,e),y(se.$$.fragment,e),y(le.$$.fragment,e),y(te.$$.fragment,e),y(oe.$$.fragment,e),y(ae.$$.fragment,e),y(re.$$.fragment,e),y(ne.$$.fragment,e),y(ie.$$.fragment,e),y(ue.$$.fragment,e),Cs=!1},d(e){s(E),e&&s(es),e&&s(k),M(P),e&&s(ss),M(Q,e),e&&s(ls),e&&s(w),e&&s(ts),e&&s(_),e&&s(os),e&&s(C),e&&s(as),e&&s(D),e&&s(rs),M(q,e),e&&s(ns),e&&s(Z),M(F),e&&s(is),e&&s(W),e&&s(ps),M(L,e),e&&s(us),e&&s(v),e&&s(hs),M(K,e),e&&s(fs),e&&s(J),e&&s(cs),e&&s(ye),e&&s(bs),M(O,e),e&&s(ds),e&&s($),M(ee),e&&s(ms),e&&s(X),e&&s(ys),M(se,e),e&&s(Ms),e&&s(j),e&&s(Js),e&&s(Te),e&&s(Ts),M(le,e),e&&s(ws),e&&s(B),M(te),e&&s(_s),e&&s(g),e&&s(vs),M(oe,e),e&&s(js),e&&s(I),e&&s(Is),M(ae,e),e&&s(Us),e&&s(H),e&&s(Es),M(re,e),e&&s(ks),e&&s(G),M(ne),e&&s(Zs),e&&s(U),e&&s($s),M(ie,e),e&&s(Bs),e&&s(pe),e&&s(Gs),e&&s(Y),e&&s(Vs),M(ue,e)}}}const po={local:"push-files-to-the-hub",sections:[{local:"models",title:"Models"},{local:"scheduler",title:"Scheduler"},{local:"pipeline",title:"Pipeline"},{local:"privacy",title:"Privacy"}],title:"Push files to the Hub"};function uo(ft){return ro(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class mo extends so{constructor(E){super();lo(this,E,uo,io,to,{})}}export{mo as default,po as metadata};
