Buckets:

download
raw
10.6 kB
import"../chunks/DsnmJJEf.js";import{i as B,h as X,C as Y,H as o,b as R,a as s,E as V,s as H}from"../chunks/Bqo1LwON.js";import{p as S,o as C,s as e,f as j,a as n,b as q,d as t,n as x}from"../chunks/DK803DsY.js";import{H as Z}from"../chunks/BaXzLV62.js";const E='{"title":"Sharing pipelines and models","local":"sharing-pipelines-and-models","sections":[{"title":"Models","local":"models","sections":[],"depth":2},{"title":"Scheduler","local":"scheduler","sections":[],"depth":2},{"title":"Pipeline","local":"pipeline","sections":[],"depth":2},{"title":"Privacy","local":"privacy","sections":[],"depth":2}],"depth":1}';var N=t('<meta name="hf:doc:metadata"/>'),Q=t("<!> <!>",1),D=t(`<p></p> <!> <!> <p>Share your pipelines, models, and schedulers on the Hub with <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin">PushToHubMixin</a>. This mixin:</p> <ol><li>creates a repository on the Hub</li> <li>saves your model, scheduler, or pipeline files so they can be reloaded later</li> <li>uploads the folder containing these files to the Hub</li></ol> <p>Log in to your Hugging Face account with your access <a href="https://huggingface.co/settings/tokens" rel="nofollow">token</a>.</p> <!> <p>Push to your user namespace with a short id (<code>"my-controlnet-model"</code>) or to an org with <code>"your-org/my-controlnet-model"</code>.</p> <!> <p>To push a model to the Hub, call <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> and specify the repository id of the model.</p> <!> <p>The <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method saves the model’s <code>config.json</code> file and the weights are automatically saved as <a href="./other-formats#safetensors">safetensors files</a>.</p> <p>Load the model again with <a href="/docs/diffusers/pr_15151/en/api/models/overview#diffusers.ModelMixin.from_pretrained">ControlNetModel.from_pretrained()</a>.</p> <!> <!> <p>To push a scheduler to the Hub, call <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> and specify the repository id of the scheduler.</p> <!> <p>The <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method saves the scheduler’s <code>scheduler_config.json</code> file to the specified repository.</p> <p>Load the scheduler again with <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained">from_pretrained()</a>.</p> <!> <!> <p>To push a pipeline to the Hub, load it with <a href="/docs/diffusers/pr_15151/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained">from_pretrained()</a>, then call <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> with a repository id.</p> <!> <p>The <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method saves each component to a subfolder in the repository. Load the pipeline again with <a href="/docs/diffusers/pr_15151/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained">DiffusionPipeline.from_pretrained()</a>.</p> <!> <!> <p>Set <code>private=True</code> in <a href="/docs/diffusers/pr_15151/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> to keep a model, scheduler, or pipeline files private.</p> <!> <p>Pass <code>create_pr=True</code> to open a pull request on an existing Hub repository instead of pushing straight to the default branch.</p> <p>Models and pipelines also accept <code>variant=</code> on push when you want a named weight file such as <code>fp16</code>. Schedulers do not use <code>variant</code>.</p> <p>Private repositories are only visible to you. Other users won’t be able to clone the repository and it won’t appear in search results. Even if a user has the URL to your private repository, they’ll receive a <code>404 - Sorry, we can't find the page you are looking for</code>. You must be <a href="https://huggingface.co/docs/huggingface_hub/quick-start#login" rel="nofollow">logged in</a> to load a model from a private repository.</p> <!> <p></p>`,1);function A(I,U){S(U,!1),C(()=>{new URLSearchParams(window.location.search).get("fw")}),B();var r=D();X("rl2c90",l=>{var a=N();H(a,"content",E),n(l,a)});var p=e(j(r),2);Y(p,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var d=e(p,2);o(d,{title:"Sharing pipelines and models",local:"sharing-pipelines-and-models",headingTag:"h1"});var h=e(d,8);R(h,{id:"login",options:["notebook","hf CLI"],children:(l,a)=>{var _=Q(),v=j(_);Z(v,{id:"login",option:"notebook",children:(i,W)=>{s(i,{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login
notebook_login()`,lang:"py",wrap:!1})},$$slots:{default:!0}});var k=e(v,2);Z(k,{id:"login",option:"hf CLI",children:(i,W)=>{s(i,{code:"aGYlMjBhdXRoJTIwbG9naW4=",highlighted:"hf auth login",lang:"bash",wrap:!1})},$$slots:{default:!0}}),n(l,_)},$$slots:{default:!0}});var u=e(h,4);o(u,{title:"Models",local:"models",headingTag:"h2"});var c=e(u,4);s(c,{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>)`,lang:"py",wrap:!1});var f=e(c,6);s(f,{code:"bW9kZWwlMjAlM0QlMjBDb250cm9sTmV0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMnlvdXItbmFtZXNwYWNlJTJGbXktY29udHJvbG5ldC1tb2RlbCUyMik=",highlighted:'model = ControlNetModel.from_pretrained(<span class="hljs-string">&quot;your-namespace/my-controlnet-model&quot;</span>)',lang:"py",wrap:!1});var y=e(f,2);o(y,{title:"Scheduler",local:"scheduler",headingTag:"h2"});var m=e(y,4);s(m,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERESU1TY2hlZHVsZXIlMEElMEFzY2hlZHVsZXIlMjAlM0QlMjBERElNU2NoZWR1bGVyKCUwQSUyMCUyMCUyMCUyMGJldGFfc3RhcnQlM0QwLjAwMDg1JTJDJTBBJTIwJTIwJTIwJTIwYmV0YV9lbmQlM0QwLjAxMiUyQyUwQSUyMCUyMCUyMCUyMGJldGFfc2NoZWR1bGUlM0QlMjJzY2FsZWRfbGluZWFyJTIyJTJDJTBBJTIwJTIwJTIwJTIwY2xpcF9zYW1wbGUlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMHNldF9hbHBoYV90b19vbmUlM0RGYWxzZSUyQyUwQSklMEFzY2hlZHVsZXIucHVzaF90b19odWIoJTIybXktZGRpbS1zY2hlZHVsZXIlMjIp",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-ddim-scheduler&quot;</span>)`,lang:"py",wrap:!1});var b=e(m,6);s(b,{code:"c2NoZWR1bGVyJTIwJTNEJTIwRERJTVNjaGVkdWxlci5mcm9tX3ByZXRyYWluZWQoJTIyeW91ci1uYW1lc3BhY2UlMkZteS1kZGltLXNjaGVkdWxlciUyMik=",highlighted:'scheduler = DDIMScheduler.from_pretrained(<span class="hljs-string">&quot;your-namespace/my-ddim-scheduler&quot;</span>)',lang:"py",wrap:!1});var M=e(b,2);o(M,{title:"Pipeline",local:"pipeline",headingTag:"h2"});var w=e(M,4);s(w,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJRd2VuJTJGUXdlbi1JbWFnZSUyMiUyQyUyMGR0eXBlJTNEdG9yY2guYmZsb2F0MTYlMkMlMjBkZXZpY2VfbWFwJTNEJTIyY3VkYSUyMiUyMCUyMCUyMyUyMG9yJTIwJTIybXBzJTIyJTJDJTIwJTIyeHB1JTIyJTJDJTIwJTIyY3B1JTIyJTBBKSUwQXBpcGVsaW5lLnB1c2hfdG9faHViKCUyMnlvdXItbmFtZXNwYWNlJTJGbXktcXdlbi1pbWFnZSUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;Qwen/Qwen-Image&quot;</span>, dtype=torch.bfloat16, device_map=<span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-comment"># or &quot;mps&quot;, &quot;xpu&quot;, &quot;cpu&quot;</span>
)
pipeline.push_to_hub(<span class="hljs-string">&quot;your-namespace/my-qwen-image&quot;</span>)`,lang:"py",wrap:!1});var J=e(w,4);s(J,{code:"cGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyeW91ci1uYW1lc3BhY2UlMkZteS1xd2VuLWltYWdlJTIyKQ==",highlighted:'pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;your-namespace/my-qwen-image&quot;</span>)',lang:"py",wrap:!1});var g=e(J,2);o(g,{title:"Privacy",local:"privacy",headingTag:"h2"});var T=e(g,4);s(T,{code:"Y29udHJvbG5ldC5wdXNoX3RvX2h1YiglMjJteS1jb250cm9sbmV0LW1vZGVsLXByaXZhdGUlMjIlMkMlMjBwcml2YXRlJTNEVHJ1ZSk=",highlighted:'controlnet.push_to_hub(<span class="hljs-string">&quot;my-controlnet-model-private&quot;</span>, private=<span class="hljs-literal">True</span>)',lang:"py",wrap:!1});var G=e(T,8);V(G,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/push_to_hub.md"}),x(2),n(I,r),q()}export{A as component};

Xet Storage Details

Size:
10.6 kB
·
Xet hash:
93e7fadae61565bdef363079427f0c1d0783ea2cd1893de1426a8c4804bd0ba5

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.