Buckets:

rtrm's picture
download
raw
26.9 kB
import{s as It,o as Rt,n as Bt}from"../chunks/scheduler.182ea377.js";import{S as Et,i as Ht,g as s,s as o,p as d,A as Nt,h as a,f as l,c as i,j as v,q as u,m as r,k as c,v as b,a as n,r as h,d as f,t as y,u as M}from"../chunks/index.008d68e4.js";import{T as Gt}from"../chunks/Tip.4f096367.js";import{I as it}from"../chunks/IconCopyLink.96bbb92b.js";import{C as T}from"../chunks/CodeBlock.5ed6eb7b.js";import{D as Xt}from"../chunks/DocNotebookDropdown.bb388256.js";function St(me){let p,U="πŸ”’ By loading a community pipeline from the Hugging Face Hub, you are trusting that the code you are loading is safe. Make sure to inspect the code online before loading and running it automatically!";return{c(){p=s("p"),p.textContent=U},l(m){p=a(m,"P",{"data-svelte-h":!0}),r(p)!=="svelte-154jbq5"&&(p.textContent=U)},m(m,w){n(m,p,w)},p:Bt,d(m){m&&l(p)}}}function Qt(me){let p,U='In steps 4 and 5, the custom <a href="https://github.com/showlab/Show-1/blob/main/showone/models/unet_3d_condition.py" rel="nofollow">UNet</a> and <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py" rel="nofollow">pipeline</a> implementation must match the format shown in their files for this example to work.';return{c(){p=s("p"),p.innerHTML=U},l(m){p=a(m,"P",{"data-svelte-h":!0}),r(p)!=="svelte-ptu9pr"&&(p.innerHTML=U)},m(m,w){n(m,p,w)},p:Bt,d(m){m&&l(p)}}}function zt(me){let p,U,m,w,he,W,lt,ce,st="Load community pipelines and components",be,G,we,_,J,fe,B,nt,de,at="Community pipelines",Ue,I,pt='Community pipelines are any <a href="/docs/diffusers/v0.25.0/zh/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a> class that are different from the original implementation as specified in their paper (for example, the <a href="/docs/diffusers/v0.25.0/zh/api/pipelines/controlnet#diffusers.StableDiffusionControlNetPipeline">StableDiffusionControlNetPipeline</a> corresponds to the <a href="https://arxiv.org/abs/2302.05543" rel="nofollow">Text-to-Image Generation with ControlNet Conditioning</a> paper). They provide additional functionality or extend the original implementation of a pipeline.',Te,R,rt='There are many cool community pipelines like <a href="https://github.com/huggingface/diffusers/tree/main/examples/community#speech-to-image" rel="nofollow">Speech to Image</a> or <a href="https://github.com/huggingface/diffusers/tree/main/examples/community#composable-stable-diffusion" rel="nofollow">Composable Stable Diffusion</a>, and you can find all the official community pipelines <a href="https://github.com/huggingface/diffusers/tree/main/examples/community" rel="nofollow">here</a>.',_e,E,mt='To load any community pipeline on the Hub, pass the repository id of the community pipeline to the <code>custom_pipeline</code> argument and the model repository where you’d like to load the pipeline weights and components from. For example, the example below loads a dummy pipeline from <a href="https://huggingface.co/hf-internal-testing/diffusers-dummy-pipeline/blob/main/pipeline.py" rel="nofollow"><code>hf-internal-testing/diffusers-dummy-pipeline</code></a> and the pipeline weights and components from <a href="https://huggingface.co/google/ddpm-cifar10-32" rel="nofollow"><code>google/ddpm-cifar10-32</code></a>:',ge,Z,ve,H,Je,N,ct='Loading an official community pipeline is similar, but you can mix loading weights from an official repository id and pass pipeline components directly. The example below loads the community <a href="https://github.com/huggingface/diffusers/tree/main/examples/community#clip-guided-stable-diffusion" rel="nofollow">CLIP Guided Stable Diffusion</a> pipeline, and you can pass the CLIP model components directly to it:',Ze,X,Ve,S,dt='For more information about community pipelines, take a look at the <a href="custom_pipeline_examples">Community pipelines</a> guide for how to use them and if you’re interested in adding a community pipeline check out the <a href="contribute_pipeline">How to contribute a community pipeline</a> guide!',je,g,V,ye,Q,ot,ue,ut="Community components",Ce,z,ht="Community components allow users to build pipelines that may have customized components that are not a part of Diffusers. If your pipeline has custom components that Diffusers doesn’t already support, you need to provide their implementations as Python modules. These customized components could be a VAE, UNet, and scheduler. In most cases, the text encoder is imported from the Transformers library. The pipeline code itself can also be customized.",$e,F,ft="This section shows how users should use community components to build a community pipeline.",ke,L,yt='You’ll use the <a href="https://huggingface.co/showlab/show-1-base" rel="nofollow">showlab/show-1-base</a> pipeline checkpoint as an example. So, let’s start loading the components:',xe,P,Mt="<li>Import and load the text encoder from Transformers:</li>",We,Y,Ge,j,bt="<li>Load a scheduler:</li>",Be,q,Ie,C,wt="<li>Load an image processor:</li>",Re,A,Ee,$,He,k,Ut='<li>Now you’ll load a <a href="https://github.com/showlab/Show-1/blob/main/showone/models/unet_3d_condition.py" rel="nofollow">custom UNet</a>, which in this example, has already been implemented in the <code>showone_unet_3d_condition.py</code> <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py" rel="nofollow">script</a> for your convenience. You’ll notice the <code>UNet3DConditionModel</code> class name is changed to <code>ShowOneUNet3DConditionModel</code> because <a href="/docs/diffusers/v0.25.0/zh/api/models/unet3d-cond#diffusers.UNet3DConditionModel">UNet3DConditionModel</a> already exists in Diffusers. Any components needed for the <code>ShowOneUNet3DConditionModel</code> class should be placed in the <code>showone_unet_3d_condition.py</code> script.</li>',Ne,D,Tt="Once this is done, you can initialize the UNet:",Xe,O,Se,x,_t='<li>Finally, you’ll load the custom pipeline code. For this example, it has already been created for you in the <code>pipeline_t2v_base_pixel.py</code> <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/pipeline_t2v_base_pixel.py" rel="nofollow">script</a>. This script contains a custom <code>TextToVideoIFPipeline</code> class for generating videos from text. Just like the custom UNet, any code needed for the custom pipeline to work should go in the <code>pipeline_t2v_base_pixel.py</code> script.</li>',Qe,K,gt="Once everything is in place, you can initialize the <code>TextToVideoIFPipeline</code> with the <code>ShowOneUNet3DConditionModel</code>:",ze,ee,Fe,te,vt="Push the pipeline to the Hub to share with the community!",Le,le,Pe,ne,Jt="After the pipeline is successfully pushed, you need a couple of changes:",Ye,oe,Zt='<li>Change the <code>_class_name</code> attribute in <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/model_index.json#L2" rel="nofollow"><code>model_index.json</code></a> to <code>&quot;pipeline_t2v_base_pixel&quot;</code> and <code>&quot;TextToVideoIFPipeline&quot;</code>.</li> <li>Upload <code>showone_unet_3d_condition.py</code> to the <code>unet</code> <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py" rel="nofollow">directory</a>.</li> <li>Upload <code>pipeline_t2v_base_pixel.py</code> to the pipeline base <a href="https://huggingface.co/sayakpaul/show-1-base-with-code/blob/main/unet/showone_unet_3d_condition.py" rel="nofollow">directory</a>.</li>',qe,ie,Vt="To run inference, simply add the <code>trust_remote_code</code> argument while initializing the pipeline to handle all the β€œmagic” behind the scenes.",Ae,se,De,ae,jt='As an additional reference example, you can refer to the repository structure of <a href="https://huggingface.co/stabilityai/japanese-stable-diffusion-xl/" rel="nofollow">stabilityai/japanese-stable-diffusion-xl</a>, that makes use of the <code>trust_remote_code</code> feature:',Oe,pe,Ke;return W=new it({}),G=new Xt({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/zh/custom_pipeline_overview.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/zh/pytorch/custom_pipeline_overview.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/zh/tensorflow/custom_pipeline_overview.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/zh/custom_pipeline_overview.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/zh/pytorch/custom_pipeline_overview.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/zh/tensorflow/custom_pipeline_overview.ipynb"}]}}),B=new it({}),Z=new Gt({props:{warning:!0,$$slots:{default:[St]},$$scope:{ctx:me}}}),H=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyZ29vZ2xlJTJGZGRwbS1jaWZhcjEwLTMyJTIyJTJDJTIwY3VzdG9tX3BpcGVsaW5lJTNEJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1kdW1teS1waXBlbGluZSUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>, custom_pipeline=<span class="hljs-string">&quot;hf-internal-testing/diffusers-dummy-pipeline&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
)`}}),X=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBJbWFnZVByb2Nlc3NvciUyQyUyMENMSVBNb2RlbCUwQSUwQWNsaXBfbW9kZWxfaWQlMjAlM0QlMjAlMjJsYWlvbiUyRkNMSVAtVmlULUItMzItbGFpb24yQi1zMzRCLWI3OUslMjIlMEElMEFmZWF0dXJlX2V4dHJhY3RvciUyMCUzRCUyMENMSVBJbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoY2xpcF9tb2RlbF9pZCklMEFjbGlwX21vZGVsJTIwJTNEJTIwQ0xJUE1vZGVsLmZyb21fcHJldHJhaW5lZChjbGlwX21vZGVsX2lkKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTJDJTBBJTIwJTIwJTIwJTIwY3VzdG9tX3BpcGVsaW5lJTNEJTIyY2xpcF9ndWlkZWRfc3RhYmxlX2RpZmZ1c2lvbiUyMiUyQyUwQSUyMCUyMCUyMCUyMGNsaXBfbW9kZWwlM0RjbGlwX21vZGVsJTJDJTBBJTIwJTIwJTIwJTIwZmVhdHVyZV9leHRyYWN0b3IlM0RmZWF0dXJlX2V4dHJhY3RvciUyQyUwQSUyMCUyMCUyMCUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPImageProcessor, CLIPModel
clip_model_id = <span class="hljs-string">&quot;laion/CLIP-ViT-B-32-laion2B-s34B-b79K&quot;</span>
feature_extractor = CLIPImageProcessor.from_pretrained(clip_model_id)
clip_model = CLIPModel.from_pretrained(clip_model_id)
pipeline = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>,
custom_pipeline=<span class="hljs-string">&quot;clip_guided_stable_diffusion&quot;</span>,
clip_model=clip_model,
feature_extractor=feature_extractor,
use_safetensors=<span class="hljs-literal">True</span>,
)`}}),Q=new it({}),Y=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFQ1VG9rZW5pemVyJTJDJTIwVDVFbmNvZGVyTW9kZWwlMEElMEFwaXBlX2lkJTIwJTNEJTIwJTIyc2hvd2xhYiUyRnNob3ctMS1iYXNlJTIyJTBBdG9rZW5pemVyJTIwJTNEJTIwVDVUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKHBpcGVfaWQlMkMlMjBzdWJmb2xkZXIlM0QlMjJ0b2tlbml6ZXIlMjIpJTBBdGV4dF9lbmNvZGVyJTIwJTNEJTIwVDVFbmNvZGVyTW9kZWwuZnJvbV9wcmV0cmFpbmVkKHBpcGVfaWQlMkMlMjBzdWJmb2xkZXIlM0QlMjJ0ZXh0X2VuY29kZXIlMjIp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> T5Tokenizer, T5EncoderModel
pipe_id = <span class="hljs-string">&quot;showlab/show-1-base&quot;</span>
tokenizer = T5Tokenizer.from_pretrained(pipe_id, subfolder=<span class="hljs-string">&quot;tokenizer&quot;</span>)
text_encoder = T5EncoderModel.from_pretrained(pipe_id, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>)`}}),q=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlciUwQSUwQXNjaGVkdWxlciUyMCUzRCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlci5mcm9tX3ByZXRyYWluZWQocGlwZV9pZCUyQyUyMHN1YmZvbGRlciUzRCUyMnNjaGVkdWxlciUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler
scheduler = DPMSolverMultistepScheduler.from_pretrained(pipe_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)`}}),A=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENMSVBGZWF0dXJlRXh0cmFjdG9yJTBBJTBBZmVhdHVyZV9leHRyYWN0b3IlMjAlM0QlMjBDTElQRmVhdHVyZUV4dHJhY3Rvci5mcm9tX3ByZXRyYWluZWQocGlwZV9pZCUyQyUyMHN1YmZvbGRlciUzRCUyMmZlYXR1cmVfZXh0cmFjdG9yJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPFeatureExtractor
feature_extractor = CLIPFeatureExtractor.from_pretrained(pipe_id, subfolder=<span class="hljs-string">&quot;feature_extractor&quot;</span>)`}}),$=new Gt({props:{warning:!0,$$slots:{default:[Qt]},$$scope:{ctx:me}}}),O=new T({props:{code:"ZnJvbSUyMHNob3dvbmVfdW5ldF8zZF9jb25kaXRpb24lMjBpbXBvcnQlMjBTaG93T25lVU5ldDNEQ29uZGl0aW9uTW9kZWwlMEElMEF1bmV0JTIwJTNEJTIwU2hvd09uZVVOZXQzRENvbmRpdGlvbk1vZGVsLmZyb21fcHJldHJhaW5lZChwaXBlX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIydW5ldCUyMik=",highlighted:`<span class="hljs-keyword">from</span> showone_unet_3d_condition <span class="hljs-keyword">import</span> ShowOneUNet3DConditionModel
unet = ShowOneUNet3DConditionModel.from_pretrained(pipe_id, subfolder=<span class="hljs-string">&quot;unet&quot;</span>)`}}),ee=new T({props:{code:"ZnJvbSUyMHBpcGVsaW5lX3Qydl9iYXNlX3BpeGVsJTIwaW1wb3J0JTIwVGV4dFRvVmlkZW9JRlBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMFRleHRUb1ZpZGVvSUZQaXBlbGluZSglMEElMjAlMjAlMjAlMjB1bmV0JTNEdW5ldCUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2RlciUzRHRleHRfZW5jb2RlciUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSUyMCUyMCUyMCUyMHNjaGVkdWxlciUzRHNjaGVkdWxlciUyQyUwQSUyMCUyMCUyMCUyMGZlYXR1cmVfZXh0cmFjdG9yJTNEZmVhdHVyZV9leHRyYWN0b3IlMEEpJTBBcGlwZWxpbmUlMjAlM0QlMjBwaXBlbGluZS50byhkZXZpY2UlM0QlMjJjdWRhJTIyKSUwQXBpcGVsaW5lLnRvcmNoX2R0eXBlJTIwJTNEJTIwdG9yY2guZmxvYXQxNg==",highlighted:`<span class="hljs-keyword">from</span> pipeline_t2v_base_pixel <span class="hljs-keyword">import</span> TextToVideoIFPipeline
<span class="hljs-keyword">import</span> torch
pipeline = TextToVideoIFPipeline(
unet=unet,
text_encoder=text_encoder,
tokenizer=tokenizer,
scheduler=scheduler,
feature_extractor=feature_extractor
)
pipeline = pipeline.to(device=<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline.torch_dtype = torch.float16`}}),le=new T({props:{code:"cGlwZWxpbmUucHVzaF90b19odWIoJTIyY3VzdG9tLXQydi1waXBlbGluZSUyMik=",highlighted:'pipeline.push_to_hub(<span class="hljs-string">&quot;custom-t2v-pipeline&quot;</span>)'}}),se=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjIlM0NjaGFuZ2UtdXNlcm5hbWUlM0UlMkYlM0NjaGFuZ2UtaWQlM0UlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyaGVsbG8lMjIlMEElMEElMjMlMjBUZXh0JTIwZW1iZWRzJTBBcHJvbXB0X2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2VtYmVkcyUyMCUzRCUyMHBpcGVsaW5lLmVuY29kZV9wcm9tcHQocHJvbXB0KSUwQSUwQSUyMyUyMEtleWZyYW1lcyUyMGdlbmVyYXRpb24lMjAoOHg2NHg0MCUyQyUyMDJmcHMpJTBBdmlkZW9fZnJhbWVzJTIwJTNEJTIwcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0X2VtYmVkcyUzRHByb21wdF9lbWJlZHMlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9wcm9tcHRfZW1iZWRzJTNEbmVnYXRpdmVfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ZyYW1lcyUzRDglMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q0MCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNENjQlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMiUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEOS4wJTJDJTBBJTIwJTIwJTIwJTIwb3V0cHV0X3R5cGUlM0QlMjJwdCUyMiUwQSkuZnJhbWVz",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch
pipeline = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;&lt;change-username&gt;/&lt;change-id&gt;&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
prompt = <span class="hljs-string">&quot;hello&quot;</span>
<span class="hljs-comment"># Text embeds</span>
prompt_embeds, negative_embeds = pipeline.encode_prompt(prompt)
<span class="hljs-comment"># Keyframes generation (8x64x40, 2fps)</span>
video_frames = pipeline(
prompt_embeds=prompt_embeds,
negative_prompt_embeds=negative_embeds,
num_frames=<span class="hljs-number">8</span>,
height=<span class="hljs-number">40</span>,
width=<span class="hljs-number">64</span>,
num_inference_steps=<span class="hljs-number">2</span>,
guidance_scale=<span class="hljs-number">9.0</span>,
output_type=<span class="hljs-string">&quot;pt&quot;</span>
).frames`}}),pe=new T({props:{code:"JTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRmphcGFuZXNlLXN0YWJsZS1kaWZmdXNpb24teGwlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUlMEEpJTBBcGlwZWxpbmUudG8oJTIyY3VkYSUyMiklMEElMEElMjMlMjBpZiUyMHVzaW5nJTIwdG9yY2glMjAlM0MlMjAyLjAlMEElMjMlMjBwaXBlbGluZS5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMiVFNiU5RiVCNCVFNyU4QSVBQyVFMyU4MCU4MSVFMyU4MiVBQiVFMyU4MyVBOSVFMyU4MyU5NSVFMyU4MyVBQiVFMyU4MiVBMiVFMyU4MyVCQyVFMyU4MyU4OCUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0KS5pbWFnZXMlNUIwJTVEJTBB",highlighted:`
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch
pipeline = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;stabilityai/japanese-stable-diffusion-xl&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>
)
pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-comment"># if using torch &lt; 2.0</span>
<span class="hljs-comment"># pipeline.enable_xformers_memory_efficient_attention()</span>
prompt = <span class="hljs-string">&quot;ζŸ΄ηŠ¬γ€γ‚«γƒ©γƒ•γƒ«γ‚’γƒΌγƒˆ&quot;</span>
image = pipeline(prompt=prompt).images[<span class="hljs-number">0</span>]
`}}),{c(){p=s("meta"),U=o(),m=s("h1"),w=s("a"),he=s("span"),d(W.$$.fragment),lt=o(),ce=s("span"),ce.textContent=st,be=o(),d(G.$$.fragment),we=o(),_=s("h2"),J=s("a"),fe=s("span"),d(B.$$.fragment),nt=o(),de=s("span"),de.textContent=at,Ue=o(),I=s("p"),I.innerHTML=pt,Te=o(),R=s("p"),R.innerHTML=rt,_e=o(),E=s("p"),E.innerHTML=mt,ge=o(),d(Z.$$.fragment),ve=o(),d(H.$$.fragment),Je=o(),N=s("p"),N.innerHTML=ct,Ze=o(),d(X.$$.fragment),Ve=o(),S=s("p"),S.innerHTML=dt,je=o(),g=s("h2"),V=s("a"),ye=s("span"),d(Q.$$.fragment),ot=o(),ue=s("span"),ue.textContent=ut,Ce=o(),z=s("p"),z.textContent=ht,$e=o(),F=s("p"),F.textContent=ft,ke=o(),L=s("p"),L.innerHTML=yt,xe=o(),P=s("ol"),P.innerHTML=Mt,We=o(),d(Y.$$.fragment),Ge=o(),j=s("ol"),j.innerHTML=bt,Be=o(),d(q.$$.fragment),Ie=o(),C=s("ol"),C.innerHTML=wt,Re=o(),d(A.$$.fragment),Ee=o(),d($.$$.fragment),He=o(),k=s("ol"),k.innerHTML=Ut,Ne=o(),D=s("p"),D.textContent=Tt,Xe=o(),d(O.$$.fragment),Se=o(),x=s("ol"),x.innerHTML=_t,Qe=o(),K=s("p"),K.innerHTML=gt,ze=o(),d(ee.$$.fragment),Fe=o(),te=s("p"),te.textContent=vt,Le=o(),d(le.$$.fragment),Pe=o(),ne=s("p"),ne.textContent=Jt,Ye=o(),oe=s("ol"),oe.innerHTML=Zt,qe=o(),ie=s("p"),ie.innerHTML=Vt,Ae=o(),d(se.$$.fragment),De=o(),ae=s("p"),ae.innerHTML=jt,Oe=o(),d(pe.$$.fragment),this.h()},l(e){const t=Nt("svelte-1phssyn",document.head);p=a(t,"META",{name:!0,content:!0}),t.forEach(l),U=i(e),m=a(e,"H1",{class:!0});var re=v(m);w=a(re,"A",{id:!0,class:!0,href:!0});var Me=v(w);he=a(Me,"SPAN",{});var Ct=v(he);u(W.$$.fragment,Ct),Ct.forEach(l),Me.forEach(l),lt=i(re),ce=a(re,"SPAN",{"data-svelte-h":!0}),r(ce)!=="svelte-m4x936"&&(ce.textContent=st),re.forEach(l),be=i(e),u(G.$$.fragment,e),we=i(e),_=a(e,"H2",{class:!0});var et=v(_);J=a(et,"A",{id:!0,class:!0,href:!0});var $t=v(J);fe=a($t,"SPAN",{});var kt=v(fe);u(B.$$.fragment,kt),kt.forEach(l),$t.forEach(l),nt=i(et),de=a(et,"SPAN",{"data-svelte-h":!0}),r(de)!=="svelte-rxzxlh"&&(de.textContent=at),et.forEach(l),Ue=i(e),I=a(e,"P",{"data-svelte-h":!0}),r(I)!=="svelte-14nm1en"&&(I.innerHTML=pt),Te=i(e),R=a(e,"P",{"data-svelte-h":!0}),r(R)!=="svelte-10en0rk"&&(R.innerHTML=rt),_e=i(e),E=a(e,"P",{"data-svelte-h":!0}),r(E)!=="svelte-1mmnk2f"&&(E.innerHTML=mt),ge=i(e),u(Z.$$.fragment,e),ve=i(e),u(H.$$.fragment,e),Je=i(e),N=a(e,"P",{"data-svelte-h":!0}),r(N)!=="svelte-1yyre8w"&&(N.innerHTML=ct),Ze=i(e),u(X.$$.fragment,e),Ve=i(e),S=a(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-1ho2g1z"&&(S.innerHTML=dt),je=i(e),g=a(e,"H2",{class:!0});var tt=v(g);V=a(tt,"A",{id:!0,class:!0,href:!0});var xt=v(V);ye=a(xt,"SPAN",{});var Wt=v(ye);u(Q.$$.fragment,Wt),Wt.forEach(l),xt.forEach(l),ot=i(tt),ue=a(tt,"SPAN",{"data-svelte-h":!0}),r(ue)!=="svelte-1kthlj8"&&(ue.textContent=ut),tt.forEach(l),Ce=i(e),z=a(e,"P",{"data-svelte-h":!0}),r(z)!=="svelte-1vh7uou"&&(z.textContent=ht),$e=i(e),F=a(e,"P",{"data-svelte-h":!0}),r(F)!=="svelte-phpvnj"&&(F.textContent=ft),ke=i(e),L=a(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-7sknw0"&&(L.innerHTML=yt),xe=i(e),P=a(e,"OL",{"data-svelte-h":!0}),r(P)!=="svelte-8ccbl9"&&(P.innerHTML=Mt),We=i(e),u(Y.$$.fragment,e),Ge=i(e),j=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(j)!=="svelte-1rtkhjg"&&(j.innerHTML=bt),Be=i(e),u(q.$$.fragment,e),Ie=i(e),C=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(C)!=="svelte-o9t4x9"&&(C.innerHTML=wt),Re=i(e),u(A.$$.fragment,e),Ee=i(e),u($.$$.fragment,e),He=i(e),k=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(k)!=="svelte-9c29t"&&(k.innerHTML=Ut),Ne=i(e),D=a(e,"P",{"data-svelte-h":!0}),r(D)!=="svelte-4yol19"&&(D.textContent=Tt),Xe=i(e),u(O.$$.fragment,e),Se=i(e),x=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(x)!=="svelte-1m9qhhm"&&(x.innerHTML=_t),Qe=i(e),K=a(e,"P",{"data-svelte-h":!0}),r(K)!=="svelte-1jpprmd"&&(K.innerHTML=gt),ze=i(e),u(ee.$$.fragment,e),Fe=i(e),te=a(e,"P",{"data-svelte-h":!0}),r(te)!=="svelte-14lz5yb"&&(te.textContent=vt),Le=i(e),u(le.$$.fragment,e),Pe=i(e),ne=a(e,"P",{"data-svelte-h":!0}),r(ne)!=="svelte-azdq2p"&&(ne.textContent=Jt),Ye=i(e),oe=a(e,"OL",{"data-svelte-h":!0}),r(oe)!=="svelte-7wsjmh"&&(oe.innerHTML=Zt),qe=i(e),ie=a(e,"P",{"data-svelte-h":!0}),r(ie)!=="svelte-xpz58c"&&(ie.innerHTML=Vt),Ae=i(e),u(se.$$.fragment,e),De=i(e),ae=a(e,"P",{"data-svelte-h":!0}),r(ae)!=="svelte-1cmjoh5"&&(ae.innerHTML=jt),Oe=i(e),u(pe.$$.fragment,e),this.h()},h(){c(p,"name","hf:doc:metadata"),c(p,"content",JSON.stringify(Ft)),c(w,"id","load-community-pipelines-and-components"),c(w,"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"),c(w,"href","#load-community-pipelines-and-components"),c(m,"class","relative group"),c(J,"id","community-pipelines"),c(J,"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"),c(J,"href","#community-pipelines"),c(_,"class","relative group"),c(V,"id","community-components"),c(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"),c(V,"href","#community-components"),c(g,"class","relative group"),c(j,"start","2"),c(C,"start","3"),c(k,"start","4"),c(x,"start","5")},m(e,t){b(document.head,p),n(e,U,t),n(e,m,t),b(m,w),b(w,he),h(W,he,null),b(m,lt),b(m,ce),n(e,be,t),h(G,e,t),n(e,we,t),n(e,_,t),b(_,J),b(J,fe),h(B,fe,null),b(_,nt),b(_,de),n(e,Ue,t),n(e,I,t),n(e,Te,t),n(e,R,t),n(e,_e,t),n(e,E,t),n(e,ge,t),h(Z,e,t),n(e,ve,t),h(H,e,t),n(e,Je,t),n(e,N,t),n(e,Ze,t),h(X,e,t),n(e,Ve,t),n(e,S,t),n(e,je,t),n(e,g,t),b(g,V),b(V,ye),h(Q,ye,null),b(g,ot),b(g,ue),n(e,Ce,t),n(e,z,t),n(e,$e,t),n(e,F,t),n(e,ke,t),n(e,L,t),n(e,xe,t),n(e,P,t),n(e,We,t),h(Y,e,t),n(e,Ge,t),n(e,j,t),n(e,Be,t),h(q,e,t),n(e,Ie,t),n(e,C,t),n(e,Re,t),h(A,e,t),n(e,Ee,t),h($,e,t),n(e,He,t),n(e,k,t),n(e,Ne,t),n(e,D,t),n(e,Xe,t),h(O,e,t),n(e,Se,t),n(e,x,t),n(e,Qe,t),n(e,K,t),n(e,ze,t),h(ee,e,t),n(e,Fe,t),n(e,te,t),n(e,Le,t),h(le,e,t),n(e,Pe,t),n(e,ne,t),n(e,Ye,t),n(e,oe,t),n(e,qe,t),n(e,ie,t),n(e,Ae,t),h(se,e,t),n(e,De,t),n(e,ae,t),n(e,Oe,t),h(pe,e,t),Ke=!0},p(e,[t]){const re={};t&2&&(re.$$scope={dirty:t,ctx:e}),Z.$set(re);const Me={};t&2&&(Me.$$scope={dirty:t,ctx:e}),$.$set(Me)},i(e){Ke||(f(W.$$.fragment,e),f(G.$$.fragment,e),f(B.$$.fragment,e),f(Z.$$.fragment,e),f(H.$$.fragment,e),f(X.$$.fragment,e),f(Q.$$.fragment,e),f(Y.$$.fragment,e),f(q.$$.fragment,e),f(A.$$.fragment,e),f($.$$.fragment,e),f(O.$$.fragment,e),f(ee.$$.fragment,e),f(le.$$.fragment,e),f(se.$$.fragment,e),f(pe.$$.fragment,e),Ke=!0)},o(e){y(W.$$.fragment,e),y(G.$$.fragment,e),y(B.$$.fragment,e),y(Z.$$.fragment,e),y(H.$$.fragment,e),y(X.$$.fragment,e),y(Q.$$.fragment,e),y(Y.$$.fragment,e),y(q.$$.fragment,e),y(A.$$.fragment,e),y($.$$.fragment,e),y(O.$$.fragment,e),y(ee.$$.fragment,e),y(le.$$.fragment,e),y(se.$$.fragment,e),y(pe.$$.fragment,e),Ke=!1},d(e){e&&(l(U),l(m),l(be),l(we),l(_),l(Ue),l(I),l(Te),l(R),l(_e),l(E),l(ge),l(ve),l(Je),l(N),l(Ze),l(Ve),l(S),l(je),l(g),l(Ce),l(z),l($e),l(F),l(ke),l(L),l(xe),l(P),l(We),l(Ge),l(j),l(Be),l(Ie),l(C),l(Re),l(Ee),l(He),l(k),l(Ne),l(D),l(Xe),l(Se),l(x),l(Qe),l(K),l(ze),l(Fe),l(te),l(Le),l(Pe),l(ne),l(Ye),l(oe),l(qe),l(ie),l(Ae),l(De),l(ae),l(Oe)),l(p),M(W),M(G,e),M(B),M(Z,e),M(H,e),M(X,e),M(Q),M(Y,e),M(q,e),M(A,e),M($,e),M(O,e),M(ee,e),M(le,e),M(se,e),M(pe,e)}}}const Ft={local:"load-community-pipelines-and-components",sections:[{local:"community-pipelines",title:"Community pipelines"},{local:"community-components",title:"Community components"}],title:"Load community pipelines and components"};function Lt(me){return Rt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kt extends Et{constructor(p){super(),Ht(this,p,Lt,zt,It,{})}}export{Kt as component};

Xet Storage Details

Size:
26.9 kB
Β·
Xet hash:
5a4ec587ec291927caaf5de15c94a5eb95d06450e03aeda590dacc5c9594f2a8

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