import{S as Nn,i as Rn,s as Hn,e as s,k as l,w as v,t as i,M as qn,c as a,d as o,m as d,x as _,a as n,h as r,b as c,N as zn,f as Fn,G as t,g as f,y as b,q as y,o as w,B as T,v as Yn,L as Qn}from"../../../chunks/vendor-hf-doc-builder.js";import{T as On}from"../../../chunks/Tip-hf-doc-builder.js";import{D as se}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as Uo}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as st}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Kn}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ei(We){let u,Z;return{c(){u=s("p"),Z=i("This pipeline is for research purposes only.")},l(x){u=a(x,"P",{});var E=n(u);Z=r(E,"This pipeline is for research purposes only."),E.forEach(o)},m(x,E){f(x,u,E),t(u,Z)},d(x){x&&o(u)}}}function ti(We){let u,Z,x,E,$;return E=new Uo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwVGV4dFRvVmlkZW9TRFBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b192aWRlbyUwQSUwQXBpcGUlMjAlM0QlMjBUZXh0VG9WaWRlb1NEUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmRhbW8tdmlsYWIlMkZ0ZXh0LXRvLXZpZGVvLW1zLTEuN2IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUwQSklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyU3BpZGVybWFuJTIwaXMlMjBzdXJmaW5nJTIyJTBBdmlkZW9fZnJhbWVzJTIwJTNEJTIwcGlwZShwcm9tcHQpLmZyYW1lcyUwQXZpZGVvX3BhdGglMjAlM0QlMjBleHBvcnRfdG9fdmlkZW8odmlkZW9fZnJhbWVzKSUwQXZpZGVvX3BhdGg=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> TextToVideoSDPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = TextToVideoSDPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;damo-vilab/text-to-video-ms-1.7b&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_model_cpu_offload()

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Spiderman is surfing&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>video_frames = pipe(prompt).frames
<span class="hljs-meta">&gt;&gt;&gt; </span>video_path = export_to_video(video_frames)
<span class="hljs-meta">&gt;&gt;&gt; </span>video_path`}}),{c(){u=s("p"),Z=i("Examples:"),x=l(),v(E.$$.fragment)},l(m){u=a(m,"P",{});var J=n(u);Z=r(J,"Examples:"),J.forEach(o),x=d(m),_(E.$$.fragment,m)},m(m,J){f(m,u,J),t(u,Z),f(m,x,J),b(E,m,J),$=!0},p:Qn,i(m){$||(y(E.$$.fragment,m),$=!0)},o(m){w(E.$$.fragment,m),$=!1},d(m){m&&o(u),m&&o(x),T(E,m)}}}function oi(We){let u,Z,x,E,$,m,J,ae,jo,at,Wo,Ht,S,L,nt,ne,Io,it,Co,qt,ie,re,Ao,Bo,Yt,Ie,Lo,Qt,Ce,rt,Xo,Ot,Ae,zo,Kt,V,lt,le,Fo,No,dt,de,Ro,Ho,pt,pe,qo,eo,U,X,ct,ce,Yo,ft,Qo,to,z,ht,j,mt,Oo,Ko,ut,es,ts,Be,os,ss,gt,W,vt,fe,as,ns,_t,bt,is,rs,Le,he,ls,oo,I,F,yt,me,ds,wt,ps,so,Xe,cs,ao,ue,no,ze,fs,io,Fe,hs,ro,ge,lo,N,ms,Tt,us,gs,po,Ne,vs,co,ve,fo,Re,_s,ho,He,_e,xt,R,bs,ys,ws,be,Ja,Ts,Et,H,xs,Es,$s,ye,Va,mo,C,q,$t,we,Ms,Mt,Zs,uo,Y,Zt,Te,Js,Vs,Jt,xe,Ds,go,A,Q,Vt,Ee,Ps,Dt,ks,vo,h,$e,Gs,Pt,Ss,Us,Me,js,qe,Ws,Is,Cs,D,Ze,As,kt,Bs,Ls,O,Xs,K,Je,zs,Ve,Fs,Gt,Ns,Rs,Hs,ee,De,qs,Pe,Ys,St,Qs,Os,Ks,te,ke,ea,M,ta,Ut,oa,sa,jt,aa,na,Wt,ia,ra,It,la,da,pa,oe,Ge,ca,B,fa,Ct,ha,ma,At,ua,ga,va,P,Se,_a,Bt,ba,ya,Lt,wa,Ta,k,Ue,xa,Xt,Ea,$a,zt,Ma,_o;return x=new On({props:{warning:!0,$$slots:{default:[ei]},$$scope:{ctx:We}}}),ae=new st({}),ne=new st({}),ce=new st({}),me=new st({}),ue=new Uo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJkYW1vLXZpbGFiJTJGdGV4dC10by12aWRlby1tcy0xLjdiJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJTcGlkZXJtYW4lMjBpcyUyMHN1cmZpbmclMjIlMEF2aWRlb19mcmFtZXMlMjAlM0QlMjBwaXBlKHByb21wdCkuZnJhbWVzJTBBdmlkZW9fcGF0aCUyMCUzRCUyMGV4cG9ydF90b192aWRlbyh2aWRlb19mcmFtZXMpJTBBdmlkZW9fcGF0aA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;damo-vilab/text-to-video-ms-1.7b&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;Spiderman is surfing&quot;</span>
video_frames = pipe(prompt).frames
video_path = export_to_video(video_frames)
video_path`}}),ge=new Uo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJkYW1vLXZpbGFiJTJGdGV4dC10by12aWRlby1tcy0xLjdiJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQSUyMyUyMG1lbW9yeSUyMG9wdGltaXphdGlvbiUwQXBpcGUuZW5hYmxlX3ZhZV9zbGljaW5nKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJEYXJ0aCUyMFZhZGVyJTIwc3VyZmluZyUyMGElMjB3YXZlJTIyJTBBdmlkZW9fZnJhbWVzJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1fZnJhbWVzJTNENjQpLmZyYW1lcyUwQXZpZGVvX3BhdGglMjAlM0QlMjBleHBvcnRfdG9fdmlkZW8odmlkZW9fZnJhbWVzKSUwQXZpZGVvX3BhdGg=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;damo-vilab/text-to-video-ms-1.7b&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>)
pipe.enable_model_cpu_offload()

<span class="hljs-comment"># memory optimization</span>
pipe.enable_vae_slicing()

prompt = <span class="hljs-string">&quot;Darth Vader surfing a wave&quot;</span>
video_frames = pipe(prompt, num_frames=<span class="hljs-number">64</span>).frames
video_path = export_to_video(video_frames)
video_path`}}),ve=new Uo({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMkMlMjBEUE1Tb2x2ZXJNdWx0aXN0ZXBTY2hlZHVsZXIlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTBBJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJkYW1vLXZpbGFiJTJGdGV4dC10by12aWRlby1tcy0xLjdiJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIpJTBBcGlwZS5zY2hlZHVsZXIlMjAlM0QlMjBEUE1Tb2x2ZXJNdWx0aXN0ZXBTY2hlZHVsZXIuZnJvbV9jb25maWcocGlwZS5zY2hlZHVsZXIuY29uZmlnKSUwQXBpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJTcGlkZXJtYW4lMjBpcyUyMHN1cmZpbmclMjIlMEF2aWRlb19mcmFtZXMlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyNSkuZnJhbWVzJTBBdmlkZW9fcGF0aCUyMCUzRCUyMGV4cG9ydF90b192aWRlbyh2aWRlb19mcmFtZXMpJTBBdmlkZW9fcGF0aA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, DPMSolverMultistepScheduler
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;damo-vilab/text-to-video-ms-1.7b&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;Spiderman is surfing&quot;</span>
video_frames = pipe(prompt, num_inference_steps=<span class="hljs-number">25</span>).frames
video_path = export_to_video(video_frames)
video_path`}}),we=new st({}),Ee=new st({}),$e=new se({props:{name:"class diffusers.TextToVideoSDPipeline",anchor:"diffusers.TextToVideoSDPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet3DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"}],parametersDescription:[{anchor:"diffusers.TextToVideoSDPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.17.1/en/api/models#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.TextToVideoSDPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder. Same as Stable Diffusion 2.`,name:"text_encoder"},{anchor:"diffusers.TextToVideoSDPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.TextToVideoSDPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.17.1/en/api/models#diffusers.UNet3DConditionModel">UNet3DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded video latents.',name:"unet"},{anchor:"diffusers.TextToVideoSDPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/v0.17.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.17.1/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.17.1/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L76"}}),Ze=new se({props:{name:"__call__",anchor:"diffusers.TextToVideoSDPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_frames",val:": int = 16"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 9.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'np'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.TextToVideoSDPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the video generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated video.`,name:"height"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated video.`,name:"width"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The number of video frames that are generated. Defaults to 16 frames which at 8 frames per seconds
amounts to 2 seconds of video.`,name:"num_frames"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality videos at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate videos that are closely linked to the text <code>prompt</code>,
usually at the expense of lower video quality.`,name:"guidance_scale"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the video generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.17.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for video
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>. Latents should be of shape
<code>(batch_size, num_channel, num_frames, height, width)</code>.`,name:"latents"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;np&quot;</code>) &#x2014;
The output format of the generate video. Choose between <code>torch.FloatTensor</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.TextToVideoSDPipelineOutput</code> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.TextToVideoSDPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py" rel="nofollow">diffusers.cross_attention</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L486",returnDescription:`
<p><code>~pipelines.stable_diffusion.TextToVideoSDPipelineOutput</code> if <code>return_dict</code> is True, otherwise a \`tuple.
When returning a tuple, the first element is a list with the generated frames.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.TextToVideoSDPipelineOutput</code> or <code>tuple</code></p>
`}}),O=new Kn({props:{anchor:"diffusers.TextToVideoSDPipeline.__call__.example",$$slots:{default:[ti]},$$scope:{ctx:We}}}),Je=new se({props:{name:"disable_vae_slicing",anchor:"diffusers.TextToVideoSDPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L127"}}),De=new se({props:{name:"disable_vae_tiling",anchor:"diffusers.TextToVideoSDPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L145"}}),ke=new se({props:{name:"enable_model_cpu_offload",anchor:"diffusers.TextToVideoSDPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L173"}}),Ge=new se({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.TextToVideoSDPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L152"}}),Se=new se({props:{name:"enable_vae_slicing",anchor:"diffusers.TextToVideoSDPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L117"}}),Ue=new se({props:{name:"enable_vae_tiling",anchor:"diffusers.TextToVideoSDPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py#L135"}}),{c(){u=s("meta"),Z=l(),v(x.$$.fragment),E=l(),$=s("h1"),m=s("a"),J=s("span"),v(ae.$$.fragment),jo=l(),at=s("span"),Wo=i("Text-to-video synthesis"),Ht=l(),S=s("h2"),L=s("a"),nt=s("span"),v(ne.$$.fragment),Io=l(),it=s("span"),Co=i("Overview"),qt=l(),ie=s("p"),re=s("a"),Ao=i("VideoFusion: Decomposed Diffusion Models for High-Quality Video Generation"),Bo=i(" by Zhengxiong Luo, Dayou Chen, Yingya Zhang, Yan Huang, Liang Wang, Yujun Shen, Deli Zhao, Jingren Zhou, Tieniu Tan."),Yt=l(),Ie=s("p"),Lo=i("The abstract of the paper is the following:"),Qt=l(),Ce=s("p"),rt=s("em"),Xo=i("A diffusion probabilistic model (DPM), which constructs a forward diffusion process by gradually adding noise to data points and learns the reverse denoising process to generate new samples, has been shown to handle complex data distribution. Despite its recent success in image synthesis, applying DPMs to video generation is still challenging due to high-dimensional data spaces. Previous methods usually adopt a standard diffusion process, where frames in the same video clip are destroyed with independent noises, ignoring the content redundancy and temporal correlation. This work presents a decomposed diffusion process via resolving the per-frame noise into a base noise that is shared among all frames and a residual noise that varies along the time axis. The denoising pipeline employs two jointly-learned networks to match the noise decomposition accordingly. Experiments on various datasets confirm that our approach, termed as VideoFusion, surpasses both GAN-based and diffusion-based alternatives in high-quality video generation. We further show that our decomposed formulation can benefit from pre-trained image diffusion models and well-support text-conditioned video creation."),Ot=l(),Ae=s("p"),zo=i("Resources:"),Kt=l(),V=s("ul"),lt=s("li"),le=s("a"),Fo=i("Website"),No=l(),dt=s("li"),de=s("a"),Ro=i("GitHub repository"),Ho=l(),pt=s("li"),pe=s("a"),qo=i("\u{1F917} Spaces"),eo=l(),U=s("h2"),X=s("a"),ct=s("span"),v(ce.$$.fragment),Yo=l(),ft=s("span"),Qo=i("Available Pipelines:"),to=l(),z=s("table"),ht=s("thead"),j=s("tr"),mt=s("th"),Oo=i("Pipeline"),Ko=l(),ut=s("th"),es=i("Tasks"),ts=l(),Be=s("th"),os=i("Demo"),ss=l(),gt=s("tbody"),W=s("tr"),vt=s("td"),fe=s("a"),as=i("TextToVideoSDPipeline"),ns=l(),_t=s("td"),bt=s("em"),is=i("Text-to-Video Generation"),rs=l(),Le=s("td"),he=s("a"),ls=i("\u{1F917} Spaces"),oo=l(),I=s("h2"),F=s("a"),yt=s("span"),v(me.$$.fragment),ds=l(),wt=s("span"),ps=i("Usage example"),so=l(),Xe=s("p"),cs=i("Let\u2019s start by generating a short video with the default length of 16 frames (2s at 8 fps):"),ao=l(),v(ue.$$.fragment),no=l(),ze=s("p"),fs=i(`Diffusers supports different optimization techniques to improve the latency
and memory footprint of a pipeline. Since videos are often more memory-heavy than images,
we can enable CPU offloading and VAE slicing to keep the memory footprint at bay.`),io=l(),Fe=s("p"),hs=i("Let\u2019s generate a video of 8 seconds (64 frames) on the same GPU using CPU offloading and VAE slicing:"),ro=l(),v(ge.$$.fragment),lo=l(),N=s("p"),ms=i("It just takes "),Tt=s("strong"),us=i("7 GBs of GPU memory"),gs=i(" to generate the 64 video frames using PyTorch 2.0, \u201Cfp16\u201D precision and the techniques mentioned above."),po=l(),Ne=s("p"),vs=i("We can also use a different scheduler easily, using the same method we\u2019d use for Stable Diffusion:"),co=l(),v(ve.$$.fragment),fo=l(),Re=s("p"),_s=i("Here are some sample outputs:"),ho=l(),He=s("table"),_e=s("tr"),xt=s("td"),R=s("center"),bs=i(`An astronaut riding a horse.
        `),ys=s("br"),ws=l(),be=s("img"),Ts=l(),Et=s("td"),H=s("center"),xs=i(`Darth vader surfing in waves.
        `),Es=s("br"),$s=l(),ye=s("img"),mo=l(),C=s("h2"),q=s("a"),$t=s("span"),v(we.$$.fragment),Ms=l(),Mt=s("span"),Zs=i("Available checkpoints"),uo=l(),Y=s("ul"),Zt=s("li"),Te=s("a"),Js=i("damo-vilab/text-to-video-ms-1.7b"),Vs=l(),Jt=s("li"),xe=s("a"),Ds=i("damo-vilab/text-to-video-ms-1.7b-legacy"),go=l(),A=s("h2"),Q=s("a"),Vt=s("span"),v(Ee.$$.fragment),Ps=l(),Dt=s("span"),ks=i("TextToVideoSDPipeline"),vo=l(),h=s("div"),v($e.$$.fragment),Gs=l(),Pt=s("p"),Ss=i("Pipeline for text-to-video generation."),Us=l(),Me=s("p"),js=i("This model inherits from "),qe=s("a"),Ws=i("DiffusionPipeline"),Is=i(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Cs=l(),D=s("div"),v(Ze.$$.fragment),As=l(),kt=s("p"),Bs=i("Function invoked when calling the pipeline for generation."),Ls=l(),v(O.$$.fragment),Xs=l(),K=s("div"),v(Je.$$.fragment),zs=l(),Ve=s("p"),Fs=i("Disable sliced VAE decoding. If "),Gt=s("code"),Ns=i("enable_vae_slicing"),Rs=i(` was previously invoked, this method will go back to
computing decoding in one step.`),Hs=l(),ee=s("div"),v(De.$$.fragment),qs=l(),Pe=s("p"),Ys=i("Disable tiled VAE decoding. If "),St=s("code"),Qs=i("enable_vae_tiling"),Os=i(` was previously invoked, this method will go back to
computing decoding in one step.`),Ks=l(),te=s("div"),v(ke.$$.fragment),ea=l(),M=s("p"),ta=i(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ut=s("code"),oa=i("enable_sequential_cpu_offload"),sa=i(", this method moves one whole model at a time to the GPU when its "),jt=s("code"),aa=i("forward"),na=i(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Wt=s("code"),ia=i("enable_sequential_cpu_offload"),ra=i(", but performance is much better due to the iterative execution of the "),It=s("code"),la=i("unet"),da=i("."),pa=l(),oe=s("div"),v(Ge.$$.fragment),ca=l(),B=s("p"),fa=i(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae have their state dicts saved to CPU and then are moved to a `),Ct=s("code"),ha=i("torch.device('meta') and loaded to GPU only when their specific submodule has its "),ma=i("forward"),At=s("code"),ua=i("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),ga=i("enable_model_cpu_offload`, but performance is lower."),va=l(),P=s("div"),v(Se.$$.fragment),_a=l(),Bt=s("p"),ba=i("Enable sliced VAE decoding."),ya=l(),Lt=s("p"),wa=i(`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),Ta=l(),k=s("div"),v(Ue.$$.fragment),xa=l(),Xt=s("p"),Ea=i("Enable tiled VAE decoding."),$a=l(),zt=s("p"),Ma=i(`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),this.h()},l(e){const p=qn('[data-svelte="svelte-1phssyn"]',document.head);u=a(p,"META",{name:!0,content:!0}),p.forEach(o),Z=d(e),_(x.$$.fragment,e),E=d(e),$=a(e,"H1",{class:!0});var je=n($);m=a(je,"A",{id:!0,class:!0,href:!0});var Ft=n(m);J=a(Ft,"SPAN",{});var Da=n(J);_(ae.$$.fragment,Da),Da.forEach(o),Ft.forEach(o),jo=d(je),at=a(je,"SPAN",{});var Pa=n(at);Wo=r(Pa,"Text-to-video synthesis"),Pa.forEach(o),je.forEach(o),Ht=d(e),S=a(e,"H2",{class:!0});var bo=n(S);L=a(bo,"A",{id:!0,class:!0,href:!0});var ka=n(L);nt=a(ka,"SPAN",{});var Ga=n(nt);_(ne.$$.fragment,Ga),Ga.forEach(o),ka.forEach(o),Io=d(bo),it=a(bo,"SPAN",{});var Sa=n(it);Co=r(Sa,"Overview"),Sa.forEach(o),bo.forEach(o),qt=d(e),ie=a(e,"P",{});var Za=n(ie);re=a(Za,"A",{href:!0,rel:!0});var Ua=n(re);Ao=r(Ua,"VideoFusion: Decomposed Diffusion Models for High-Quality Video Generation"),Ua.forEach(o),Bo=r(Za," by Zhengxiong Luo, Dayou Chen, Yingya Zhang, Yan Huang, Liang Wang, Yujun Shen, Deli Zhao, Jingren Zhou, Tieniu Tan."),Za.forEach(o),Yt=d(e),Ie=a(e,"P",{});var ja=n(Ie);Lo=r(ja,"The abstract of the paper is the following:"),ja.forEach(o),Qt=d(e),Ce=a(e,"P",{});var Wa=n(Ce);rt=a(Wa,"EM",{});var Ia=n(rt);Xo=r(Ia,"A diffusion probabilistic model (DPM), which constructs a forward diffusion process by gradually adding noise to data points and learns the reverse denoising process to generate new samples, has been shown to handle complex data distribution. Despite its recent success in image synthesis, applying DPMs to video generation is still challenging due to high-dimensional data spaces. Previous methods usually adopt a standard diffusion process, where frames in the same video clip are destroyed with independent noises, ignoring the content redundancy and temporal correlation. This work presents a decomposed diffusion process via resolving the per-frame noise into a base noise that is shared among all frames and a residual noise that varies along the time axis. The denoising pipeline employs two jointly-learned networks to match the noise decomposition accordingly. Experiments on various datasets confirm that our approach, termed as VideoFusion, surpasses both GAN-based and diffusion-based alternatives in high-quality video generation. We further show that our decomposed formulation can benefit from pre-trained image diffusion models and well-support text-conditioned video creation."),Ia.forEach(o),Wa.forEach(o),Ot=d(e),Ae=a(e,"P",{});var Ca=n(Ae);zo=r(Ca,"Resources:"),Ca.forEach(o),Kt=d(e),V=a(e,"UL",{});var Ye=n(V);lt=a(Ye,"LI",{});var Aa=n(lt);le=a(Aa,"A",{href:!0,rel:!0});var Ba=n(le);Fo=r(Ba,"Website"),Ba.forEach(o),Aa.forEach(o),No=d(Ye),dt=a(Ye,"LI",{});var La=n(dt);de=a(La,"A",{href:!0,rel:!0});var Xa=n(de);Ro=r(Xa,"GitHub repository"),Xa.forEach(o),La.forEach(o),Ho=d(Ye),pt=a(Ye,"LI",{});var za=n(pt);pe=a(za,"A",{href:!0,rel:!0});var Fa=n(pe);qo=r(Fa,"\u{1F917} Spaces"),Fa.forEach(o),za.forEach(o),Ye.forEach(o),eo=d(e),U=a(e,"H2",{class:!0});var yo=n(U);X=a(yo,"A",{id:!0,class:!0,href:!0});var Na=n(X);ct=a(Na,"SPAN",{});var Ra=n(ct);_(ce.$$.fragment,Ra),Ra.forEach(o),Na.forEach(o),Yo=d(yo),ft=a(yo,"SPAN",{});var Ha=n(ft);Qo=r(Ha,"Available Pipelines:"),Ha.forEach(o),yo.forEach(o),to=d(e),z=a(e,"TABLE",{});var wo=n(z);ht=a(wo,"THEAD",{});var qa=n(ht);j=a(qa,"TR",{});var Qe=n(j);mt=a(Qe,"TH",{});var Ya=n(mt);Oo=r(Ya,"Pipeline"),Ya.forEach(o),Ko=d(Qe),ut=a(Qe,"TH",{});var Qa=n(ut);es=r(Qa,"Tasks"),Qa.forEach(o),ts=d(Qe),Be=a(Qe,"TH",{align:!0});var Oa=n(Be);os=r(Oa,"Demo"),Oa.forEach(o),Qe.forEach(o),qa.forEach(o),ss=d(wo),gt=a(wo,"TBODY",{});var Ka=n(gt);W=a(Ka,"TR",{});var Oe=n(W);vt=a(Oe,"TD",{});var en=n(vt);fe=a(en,"A",{href:!0,rel:!0});var tn=n(fe);as=r(tn,"TextToVideoSDPipeline"),tn.forEach(o),en.forEach(o),ns=d(Oe),_t=a(Oe,"TD",{});var on=n(_t);bt=a(on,"EM",{});var sn=n(bt);is=r(sn,"Text-to-Video Generation"),sn.forEach(o),on.forEach(o),rs=d(Oe),Le=a(Oe,"TD",{align:!0});var an=n(Le);he=a(an,"A",{href:!0,rel:!0});var nn=n(he);ls=r(nn,"\u{1F917} Spaces"),nn.forEach(o),an.forEach(o),Oe.forEach(o),Ka.forEach(o),wo.forEach(o),oo=d(e),I=a(e,"H2",{class:!0});var To=n(I);F=a(To,"A",{id:!0,class:!0,href:!0});var rn=n(F);yt=a(rn,"SPAN",{});var ln=n(yt);_(me.$$.fragment,ln),ln.forEach(o),rn.forEach(o),ds=d(To),wt=a(To,"SPAN",{});var dn=n(wt);ps=r(dn,"Usage example"),dn.forEach(o),To.forEach(o),so=d(e),Xe=a(e,"P",{});var pn=n(Xe);cs=r(pn,"Let\u2019s start by generating a short video with the default length of 16 frames (2s at 8 fps):"),pn.forEach(o),ao=d(e),_(ue.$$.fragment,e),no=d(e),ze=a(e,"P",{});var cn=n(ze);fs=r(cn,`Diffusers supports different optimization techniques to improve the latency
and memory footprint of a pipeline. Since videos are often more memory-heavy than images,
we can enable CPU offloading and VAE slicing to keep the memory footprint at bay.`),cn.forEach(o),io=d(e),Fe=a(e,"P",{});var fn=n(Fe);hs=r(fn,"Let\u2019s generate a video of 8 seconds (64 frames) on the same GPU using CPU offloading and VAE slicing:"),fn.forEach(o),ro=d(e),_(ge.$$.fragment,e),lo=d(e),N=a(e,"P",{});var xo=n(N);ms=r(xo,"It just takes "),Tt=a(xo,"STRONG",{});var hn=n(Tt);us=r(hn,"7 GBs of GPU memory"),hn.forEach(o),gs=r(xo," to generate the 64 video frames using PyTorch 2.0, \u201Cfp16\u201D precision and the techniques mentioned above."),xo.forEach(o),po=d(e),Ne=a(e,"P",{});var mn=n(Ne);vs=r(mn,"We can also use a different scheduler easily, using the same method we\u2019d use for Stable Diffusion:"),mn.forEach(o),co=d(e),_(ve.$$.fragment,e),fo=d(e),Re=a(e,"P",{});var un=n(Re);_s=r(un,"Here are some sample outputs:"),un.forEach(o),ho=d(e),He=a(e,"TABLE",{});var gn=n(He);_e=a(gn,"TR",{});var Eo=n(_e);xt=a(Eo,"TD",{});var vn=n(xt);R=a(vn,"CENTER",{});var Nt=n(R);bs=r(Nt,`An astronaut riding a horse.
        `),ys=a(Nt,"BR",{}),ws=d(Nt),be=a(Nt,"IMG",{src:!0,alt:!0,style:!0}),Nt.forEach(o),vn.forEach(o),Ts=d(Eo),Et=a(Eo,"TD",{});var _n=n(Et);H=a(_n,"CENTER",{});var Rt=n(H);xs=r(Rt,`Darth vader surfing in waves.
        `),Es=a(Rt,"BR",{}),$s=d(Rt),ye=a(Rt,"IMG",{src:!0,alt:!0,style:!0}),Rt.forEach(o),_n.forEach(o),Eo.forEach(o),gn.forEach(o),mo=d(e),C=a(e,"H2",{class:!0});var $o=n(C);q=a($o,"A",{id:!0,class:!0,href:!0});var bn=n(q);$t=a(bn,"SPAN",{});var yn=n($t);_(we.$$.fragment,yn),yn.forEach(o),bn.forEach(o),Ms=d($o),Mt=a($o,"SPAN",{});var wn=n(Mt);Zs=r(wn,"Available checkpoints"),wn.forEach(o),$o.forEach(o),uo=d(e),Y=a(e,"UL",{});var Mo=n(Y);Zt=a(Mo,"LI",{});var Tn=n(Zt);Te=a(Tn,"A",{href:!0,rel:!0});var xn=n(Te);Js=r(xn,"damo-vilab/text-to-video-ms-1.7b"),xn.forEach(o),Tn.forEach(o),Vs=d(Mo),Jt=a(Mo,"LI",{});var En=n(Jt);xe=a(En,"A",{href:!0,rel:!0});var $n=n(xe);Ds=r($n,"damo-vilab/text-to-video-ms-1.7b-legacy"),$n.forEach(o),En.forEach(o),Mo.forEach(o),go=d(e),A=a(e,"H2",{class:!0});var Zo=n(A);Q=a(Zo,"A",{id:!0,class:!0,href:!0});var Mn=n(Q);Vt=a(Mn,"SPAN",{});var Zn=n(Vt);_(Ee.$$.fragment,Zn),Zn.forEach(o),Mn.forEach(o),Ps=d(Zo),Dt=a(Zo,"SPAN",{});var Jn=n(Dt);ks=r(Jn,"TextToVideoSDPipeline"),Jn.forEach(o),Zo.forEach(o),vo=d(e),h=a(e,"DIV",{class:!0});var g=n(h);_($e.$$.fragment,g),Gs=d(g),Pt=a(g,"P",{});var Vn=n(Pt);Ss=r(Vn,"Pipeline for text-to-video generation."),Vn.forEach(o),Us=d(g),Me=a(g,"P",{});var Jo=n(Me);js=r(Jo,"This model inherits from "),qe=a(Jo,"A",{href:!0});var Dn=n(qe);Ws=r(Dn,"DiffusionPipeline"),Dn.forEach(o),Is=r(Jo,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Jo.forEach(o),Cs=d(g),D=a(g,"DIV",{class:!0});var Ke=n(D);_(Ze.$$.fragment,Ke),As=d(Ke),kt=a(Ke,"P",{});var Pn=n(kt);Bs=r(Pn,"Function invoked when calling the pipeline for generation."),Pn.forEach(o),Ls=d(Ke),_(O.$$.fragment,Ke),Ke.forEach(o),Xs=d(g),K=a(g,"DIV",{class:!0});var Vo=n(K);_(Je.$$.fragment,Vo),zs=d(Vo),Ve=a(Vo,"P",{});var Do=n(Ve);Fs=r(Do,"Disable sliced VAE decoding. If "),Gt=a(Do,"CODE",{});var kn=n(Gt);Ns=r(kn,"enable_vae_slicing"),kn.forEach(o),Rs=r(Do,` was previously invoked, this method will go back to
computing decoding in one step.`),Do.forEach(o),Vo.forEach(o),Hs=d(g),ee=a(g,"DIV",{class:!0});var Po=n(ee);_(De.$$.fragment,Po),qs=d(Po),Pe=a(Po,"P",{});var ko=n(Pe);Ys=r(ko,"Disable tiled VAE decoding. If "),St=a(ko,"CODE",{});var Gn=n(St);Qs=r(Gn,"enable_vae_tiling"),Gn.forEach(o),Os=r(ko,` was previously invoked, this method will go back to
computing decoding in one step.`),ko.forEach(o),Po.forEach(o),Ks=d(g),te=a(g,"DIV",{class:!0});var Go=n(te);_(ke.$$.fragment,Go),ea=d(Go),M=a(Go,"P",{});var G=n(M);ta=r(G,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ut=a(G,"CODE",{});var Sn=n(Ut);oa=r(Sn,"enable_sequential_cpu_offload"),Sn.forEach(o),sa=r(G,", this method moves one whole model at a time to the GPU when its "),jt=a(G,"CODE",{});var Un=n(jt);aa=r(Un,"forward"),Un.forEach(o),na=r(G,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Wt=a(G,"CODE",{});var jn=n(Wt);ia=r(jn,"enable_sequential_cpu_offload"),jn.forEach(o),ra=r(G,", but performance is much better due to the iterative execution of the "),It=a(G,"CODE",{});var Wn=n(It);la=r(Wn,"unet"),Wn.forEach(o),da=r(G,"."),G.forEach(o),Go.forEach(o),pa=d(g),oe=a(g,"DIV",{class:!0});var So=n(oe);_(Ge.$$.fragment,So),ca=d(So),B=a(So,"P",{});var et=n(B);fa=r(et,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae have their state dicts saved to CPU and then are moved to a `),Ct=a(et,"CODE",{});var In=n(Ct);ha=r(In,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),In.forEach(o),ma=r(et,"forward"),At=a(et,"CODE",{});var Cn=n(At);ua=r(Cn,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Cn.forEach(o),ga=r(et,"enable_model_cpu_offload`, but performance is lower."),et.forEach(o),So.forEach(o),va=d(g),P=a(g,"DIV",{class:!0});var tt=n(P);_(Se.$$.fragment,tt),_a=d(tt),Bt=a(tt,"P",{});var An=n(Bt);ba=r(An,"Enable sliced VAE decoding."),An.forEach(o),ya=d(tt),Lt=a(tt,"P",{});var Bn=n(Lt);wa=r(Bn,`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),Bn.forEach(o),tt.forEach(o),Ta=d(g),k=a(g,"DIV",{class:!0});var ot=n(k);_(Ue.$$.fragment,ot),xa=d(ot),Xt=a(ot,"P",{});var Ln=n(Xt);Ea=r(Ln,"Enable tiled VAE decoding."),Ln.forEach(o),$a=d(ot),zt=a(ot,"P",{});var Xn=n(zt);Ma=r(Xn,`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),Xn.forEach(o),ot.forEach(o),g.forEach(o),this.h()},h(){c(u,"name","hf:doc:metadata"),c(u,"content",JSON.stringify(si)),c(m,"id","texttovideo-synthesis"),c(m,"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(m,"href","#texttovideo-synthesis"),c($,"class","relative group"),c(L,"id","overview"),c(L,"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(L,"href","#overview"),c(S,"class","relative group"),c(re,"href","https://arxiv.org/abs/2303.08320"),c(re,"rel","nofollow"),c(le,"href","https://modelscope.cn/models/damo/text-to-video-synthesis/summary"),c(le,"rel","nofollow"),c(de,"href","https://github.com/modelscope/modelscope/"),c(de,"rel","nofollow"),c(pe,"href","https://huggingface.co/spaces/damo-vilab/modelscope-text-to-video-synthesis"),c(pe,"rel","nofollow"),c(X,"id","available-pipelines"),c(X,"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(X,"href","#available-pipelines"),c(U,"class","relative group"),c(Be,"align","center"),c(fe,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/text_to_video_synthesis/pipeline_text_to_video_synth.py"),c(fe,"rel","nofollow"),c(he,"href","https://huggingface.co/spaces/damo-vilab/modelscope-text-to-video-synthesis"),c(he,"rel","nofollow"),c(Le,"align","center"),c(F,"id","usage-example"),c(F,"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(F,"href","#usage-example"),c(I,"class","relative group"),zn(be.src,Ja="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astr.gif")||c(be,"src",Ja),c(be,"alt","An astronaut riding a horse."),Fn(be,"width","300px"),zn(ye.src,Va="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/vader.gif")||c(ye,"src",Va),c(ye,"alt","Darth vader surfing in waves."),Fn(ye,"width","300px"),c(q,"id","available-checkpoints"),c(q,"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(q,"href","#available-checkpoints"),c(C,"class","relative group"),c(Te,"href","https://huggingface.co/damo-vilab/text-to-video-ms-1.7b/"),c(Te,"rel","nofollow"),c(xe,"href","https://huggingface.co/damo-vilab/text-to-video-ms-1.7b-legacy"),c(xe,"rel","nofollow"),c(Q,"id","diffusers.TextToVideoSDPipeline"),c(Q,"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(Q,"href","#diffusers.TextToVideoSDPipeline"),c(A,"class","relative group"),c(qe,"href","/docs/diffusers/v0.17.1/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),c(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,p){t(document.head,u),f(e,Z,p),b(x,e,p),f(e,E,p),f(e,$,p),t($,m),t(m,J),b(ae,J,null),t($,jo),t($,at),t(at,Wo),f(e,Ht,p),f(e,S,p),t(S,L),t(L,nt),b(ne,nt,null),t(S,Io),t(S,it),t(it,Co),f(e,qt,p),f(e,ie,p),t(ie,re),t(re,Ao),t(ie,Bo),f(e,Yt,p),f(e,Ie,p),t(Ie,Lo),f(e,Qt,p),f(e,Ce,p),t(Ce,rt),t(rt,Xo),f(e,Ot,p),f(e,Ae,p),t(Ae,zo),f(e,Kt,p),f(e,V,p),t(V,lt),t(lt,le),t(le,Fo),t(V,No),t(V,dt),t(dt,de),t(de,Ro),t(V,Ho),t(V,pt),t(pt,pe),t(pe,qo),f(e,eo,p),f(e,U,p),t(U,X),t(X,ct),b(ce,ct,null),t(U,Yo),t(U,ft),t(ft,Qo),f(e,to,p),f(e,z,p),t(z,ht),t(ht,j),t(j,mt),t(mt,Oo),t(j,Ko),t(j,ut),t(ut,es),t(j,ts),t(j,Be),t(Be,os),t(z,ss),t(z,gt),t(gt,W),t(W,vt),t(vt,fe),t(fe,as),t(W,ns),t(W,_t),t(_t,bt),t(bt,is),t(W,rs),t(W,Le),t(Le,he),t(he,ls),f(e,oo,p),f(e,I,p),t(I,F),t(F,yt),b(me,yt,null),t(I,ds),t(I,wt),t(wt,ps),f(e,so,p),f(e,Xe,p),t(Xe,cs),f(e,ao,p),b(ue,e,p),f(e,no,p),f(e,ze,p),t(ze,fs),f(e,io,p),f(e,Fe,p),t(Fe,hs),f(e,ro,p),b(ge,e,p),f(e,lo,p),f(e,N,p),t(N,ms),t(N,Tt),t(Tt,us),t(N,gs),f(e,po,p),f(e,Ne,p),t(Ne,vs),f(e,co,p),b(ve,e,p),f(e,fo,p),f(e,Re,p),t(Re,_s),f(e,ho,p),f(e,He,p),t(He,_e),t(_e,xt),t(xt,R),t(R,bs),t(R,ys),t(R,ws),t(R,be),t(_e,Ts),t(_e,Et),t(Et,H),t(H,xs),t(H,Es),t(H,$s),t(H,ye),f(e,mo,p),f(e,C,p),t(C,q),t(q,$t),b(we,$t,null),t(C,Ms),t(C,Mt),t(Mt,Zs),f(e,uo,p),f(e,Y,p),t(Y,Zt),t(Zt,Te),t(Te,Js),t(Y,Vs),t(Y,Jt),t(Jt,xe),t(xe,Ds),f(e,go,p),f(e,A,p),t(A,Q),t(Q,Vt),b(Ee,Vt,null),t(A,Ps),t(A,Dt),t(Dt,ks),f(e,vo,p),f(e,h,p),b($e,h,null),t(h,Gs),t(h,Pt),t(Pt,Ss),t(h,Us),t(h,Me),t(Me,js),t(Me,qe),t(qe,Ws),t(Me,Is),t(h,Cs),t(h,D),b(Ze,D,null),t(D,As),t(D,kt),t(kt,Bs),t(D,Ls),b(O,D,null),t(h,Xs),t(h,K),b(Je,K,null),t(K,zs),t(K,Ve),t(Ve,Fs),t(Ve,Gt),t(Gt,Ns),t(Ve,Rs),t(h,Hs),t(h,ee),b(De,ee,null),t(ee,qs),t(ee,Pe),t(Pe,Ys),t(Pe,St),t(St,Qs),t(Pe,Os),t(h,Ks),t(h,te),b(ke,te,null),t(te,ea),t(te,M),t(M,ta),t(M,Ut),t(Ut,oa),t(M,sa),t(M,jt),t(jt,aa),t(M,na),t(M,Wt),t(Wt,ia),t(M,ra),t(M,It),t(It,la),t(M,da),t(h,pa),t(h,oe),b(Ge,oe,null),t(oe,ca),t(oe,B),t(B,fa),t(B,Ct),t(Ct,ha),t(B,ma),t(B,At),t(At,ua),t(B,ga),t(h,va),t(h,P),b(Se,P,null),t(P,_a),t(P,Bt),t(Bt,ba),t(P,ya),t(P,Lt),t(Lt,wa),t(h,Ta),t(h,k),b(Ue,k,null),t(k,xa),t(k,Xt),t(Xt,Ea),t(k,$a),t(k,zt),t(zt,Ma),_o=!0},p(e,[p]){const je={};p&2&&(je.$$scope={dirty:p,ctx:e}),x.$set(je);const Ft={};p&2&&(Ft.$$scope={dirty:p,ctx:e}),O.$set(Ft)},i(e){_o||(y(x.$$.fragment,e),y(ae.$$.fragment,e),y(ne.$$.fragment,e),y(ce.$$.fragment,e),y(me.$$.fragment,e),y(ue.$$.fragment,e),y(ge.$$.fragment,e),y(ve.$$.fragment,e),y(we.$$.fragment,e),y(Ee.$$.fragment,e),y($e.$$.fragment,e),y(Ze.$$.fragment,e),y(O.$$.fragment,e),y(Je.$$.fragment,e),y(De.$$.fragment,e),y(ke.$$.fragment,e),y(Ge.$$.fragment,e),y(Se.$$.fragment,e),y(Ue.$$.fragment,e),_o=!0)},o(e){w(x.$$.fragment,e),w(ae.$$.fragment,e),w(ne.$$.fragment,e),w(ce.$$.fragment,e),w(me.$$.fragment,e),w(ue.$$.fragment,e),w(ge.$$.fragment,e),w(ve.$$.fragment,e),w(we.$$.fragment,e),w(Ee.$$.fragment,e),w($e.$$.fragment,e),w(Ze.$$.fragment,e),w(O.$$.fragment,e),w(Je.$$.fragment,e),w(De.$$.fragment,e),w(ke.$$.fragment,e),w(Ge.$$.fragment,e),w(Se.$$.fragment,e),w(Ue.$$.fragment,e),_o=!1},d(e){o(u),e&&o(Z),T(x,e),e&&o(E),e&&o($),T(ae),e&&o(Ht),e&&o(S),T(ne),e&&o(qt),e&&o(ie),e&&o(Yt),e&&o(Ie),e&&o(Qt),e&&o(Ce),e&&o(Ot),e&&o(Ae),e&&o(Kt),e&&o(V),e&&o(eo),e&&o(U),T(ce),e&&o(to),e&&o(z),e&&o(oo),e&&o(I),T(me),e&&o(so),e&&o(Xe),e&&o(ao),T(ue,e),e&&o(no),e&&o(ze),e&&o(io),e&&o(Fe),e&&o(ro),T(ge,e),e&&o(lo),e&&o(N),e&&o(po),e&&o(Ne),e&&o(co),T(ve,e),e&&o(fo),e&&o(Re),e&&o(ho),e&&o(He),e&&o(mo),e&&o(C),T(we),e&&o(uo),e&&o(Y),e&&o(go),e&&o(A),T(Ee),e&&o(vo),e&&o(h),T($e),T(Ze),T(O),T(Je),T(De),T(ke),T(Ge),T(Se),T(Ue)}}}const si={local:"texttovideo-synthesis",sections:[{local:"overview",title:"Overview"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"usage-example",title:"Usage example "},{local:"available-checkpoints",title:"Available checkpoints "},{local:"diffusers.TextToVideoSDPipeline",title:"TextToVideoSDPipeline"}],title:"Text-to-video synthesis"};function ai(We){return Yn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ci extends Nn{constructor(u){super();Rn(this,u,ai,oi,Hn,{})}}export{ci as default,si as metadata};
