import{s as Le,o as Ee,n as ze}from"../chunks/scheduler.8c3d61f6.js";import{S as Se,i as Qe,g as l,s as o,r as y,A as qe,h as r,f as n,c as i,j as ee,u as b,x as m,k as E,y as c,a as s,v as M,d as w,t as v,w as T}from"../chunks/index.da70eac4.js";import{T as Ae}from"../chunks/Tip.1d9b8c37.js";import{D as we}from"../chunks/Docstring.dcbc19b1.js";import{C as Oe}from"../chunks/CodeBlock.a9c4becf.js";import{E as Ke}from"../chunks/ExampleCodeBlock.da4c0768.js";import{H as ve,E as et}from"../chunks/getInferenceSnippets.86beaec3.js";function tt(S){let a,I='Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers.md">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading.md#reuse-a-pipeline">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.';return{c(){a=l("p"),a.innerHTML=I},l(p){a=r(p,"P",{"data-svelte-h":!0}),m(a)!=="svelte-w7r39y"&&(a.innerHTML=I)},m(p,h){s(p,a,h)},p:ze,d(p){p&&n(a)}}}function nt(S){let a,I="Examples:",p,h,g;return h=new Oe({props:{code:" ",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> ConsisIDPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.pipelines.consisid.consisid_utils <span class="hljs-keyword">import</span> prepare_face_models, process_face_embeddings_infer
<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><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> snapshot_download

<span class="hljs-meta">&gt;&gt;&gt; </span>snapshot_download(repo_id=<span class="hljs-string">&quot;BestWishYsh/ConsisID-preview&quot;</span>, local_dir=<span class="hljs-string">&quot;BestWishYsh/ConsisID-preview&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>(
<span class="hljs-meta">... </span>    face_helper_1,
<span class="hljs-meta">... </span>    face_helper_2,
<span class="hljs-meta">... </span>    face_clip_model,
<span class="hljs-meta">... </span>    face_main_model,
<span class="hljs-meta">... </span>    eva_transform_mean,
<span class="hljs-meta">... </span>    eva_transform_std,
<span class="hljs-meta">... </span>) = prepare_face_models(<span class="hljs-string">&quot;BestWishYsh/ConsisID-preview&quot;</span>, device=<span class="hljs-string">&quot;cuda&quot;</span>, dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = ConsisIDPipeline.from_pretrained(<span class="hljs-string">&quot;BestWishYsh/ConsisID-preview&quot;</span>, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># ConsisID works well with long and well-described prompts. Make sure the face in the image is clearly visible (e.g., preferably half-body or full-body).</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;The video captures a boy walking along a city street, filmed in black and white on a classic 35mm camera. His expression is thoughtful, his brow slightly furrowed as if he&#x27;s lost in contemplation. The film grain adds a textured, timeless quality to the image, evoking a sense of nostalgia. Around him, the cityscape is filled with vintage buildings, cobblestone sidewalks, and softly blurred figures passing by, their outlines faint and indistinct. Streetlights cast a gentle glow, while shadows play across the boy&#x27;s path, adding depth to the scene. The lighting highlights the boy&#x27;s subtle smile, hinting at a fleeting moment of curiosity. The overall cinematic atmosphere, complete with classic film still aesthetics and dramatic contrasts, gives the scene an evocative and introspective feel.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/consisid/consisid_input.png?download=true&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>id_cond, id_vit_hidden, image, face_kps = process_face_embeddings_infer(
<span class="hljs-meta">... </span>    face_helper_1,
<span class="hljs-meta">... </span>    face_clip_model,
<span class="hljs-meta">... </span>    face_helper_2,
<span class="hljs-meta">... </span>    eva_transform_mean,
<span class="hljs-meta">... </span>    eva_transform_std,
<span class="hljs-meta">... </span>    face_main_model,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;cuda&quot;</span>,
<span class="hljs-meta">... </span>    torch.bfloat16,
<span class="hljs-meta">... </span>    image,
<span class="hljs-meta">... </span>    is_align_face=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>video = pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">50</span>,
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">6.0</span>,
<span class="hljs-meta">... </span>    use_dynamic_cfg=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    id_vit_hidden=id_vit_hidden,
<span class="hljs-meta">... </span>    id_cond=id_cond,
<span class="hljs-meta">... </span>    kps_cond=face_kps,
<span class="hljs-meta">... </span>    generator=torch.Generator(<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">42</span>),
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>export_to_video(video.frames[<span class="hljs-number">0</span>], <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">8</span>)`,wrap:!1}}),{c(){a=l("p"),a.textContent=I,p=o(),y(h.$$.fragment)},l(d){a=r(d,"P",{"data-svelte-h":!0}),m(a)!=="svelte-kvfsh7"&&(a.textContent=I),p=i(d),b(h.$$.fragment,d)},m(d,_){s(d,a,_),s(d,p,_),M(h,d,_),g=!0},p:ze,i(d){g||(w(h.$$.fragment,d),g=!0)},o(d){v(h.$$.fragment,d),g=!1},d(d){d&&(n(a),n(p)),T(h,d)}}}function st(S){let a,I,p,h,g,d,_,Ge='<img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/>',ne,G,ke='<a href="https://huggingface.co/papers/2411.17440" rel="nofollow">Identity-Preserving Text-to-Video Generation by Frequency Decomposition</a> from Peking University &amp; University of Rochester &amp; etc, by Shenghai Yuan, Jinfa Huang, Xianyi He, Yunyang Ge, Yujun Shi, Liuhan Chen, Jiebo Luo, Li Yuan.',se,k,Be="The abstract from the paper is:",oe,B,De='<em>Identity-preserving text-to-video (IPT2V) generation aims to create high-fidelity videos with consistent human identity. It is an important task in video generation but remains an open problem for generative models. This paper pushes the technical frontier of IPT2V in two directions that have not been resolved in the literature: (1) A tuning-free pipeline without tedious case-by-case finetuning, and (2) A frequency-aware heuristic identity-preserving Diffusion Transformer (DiT)-based control scheme. To achieve these goals, we propose <strong>ConsisID</strong>, a tuning-free DiT-based controllable IPT2V model to keep human-<strong>id</strong>entity <strong>consis</strong>tent in the generated video. Inspired by prior findings in frequency analysis of vision/diffusion transformers, it employs identity-control signals in the frequency domain, where facial features can be decomposed into low-frequency global features (e.g., profile, proportions) and high-frequency intrinsic features (e.g., identity markers that remain unaffected by pose changes). First, from a low-frequency perspective, we introduce a global facial extractor, which encodes the reference image and facial key points into a latent space, generating features enriched with low-frequency information. These features are then integrated into the shallow layers of the network to alleviate training challenges associated with DiT. Second, from a high-frequency perspective, we design a local facial extractor to capture high-frequency details and inject them into the transformer blocks, enhancing the model’s ability to preserve fine-grained features. To leverage the frequency information for identity preservation, we propose a hierarchical training strategy, transforming a vanilla pre-trained video generation model into an IPT2V model. Extensive experiments demonstrate that our frequency-aware heuristic scheme provides an optimal control solution for DiT-based models. Thanks to this scheme, our <strong>ConsisID</strong> achieves excellent results in generating high-quality, identity-preserving videos, making strides towards more effective IPT2V. The model weight of ConsID is publicly available at <a href="https://github.com/PKU-YuanGroup/ConsisID" rel="nofollow">https://github.com/PKU-YuanGroup/ConsisID</a>.</em>',ie,Z,ae,D,We='This pipeline was contributed by <a href="https://github.com/SHYuanBest" rel="nofollow">SHYuanBest</a>. The original codebase can be found <a href="https://github.com/PKU-YuanGroup/ConsisID" rel="nofollow">here</a>. The original weights can be found under <a href="https://huggingface.co/BestWishYsh" rel="nofollow">hf.co/BestWishYsh</a>.',le,W,Pe="There are two official ConsisID checkpoints for identity-preserving text-to-video.",re,P,$e='<thead><tr><th align="center">checkpoints</th> <th align="center">recommended inference dtype</th></tr></thead> <tbody><tr><td align="center"><a href="https://huggingface.co/BestWishYsh/ConsisID-preview" rel="nofollow"><code>BestWishYsh/ConsisID-preview</code></a></td> <td align="center">torch.bfloat16</td></tr> <tr><td align="center"><a href="https://huggingface.co/BestWishYsh/ConsisID-preview" rel="nofollow"><code>BestWishYsh/ConsisID-1.5</code></a></td> <td align="center">torch.bfloat16</td></tr></tbody>',de,$,pe,N,Ne='ConsisID requires about 44 GB of GPU memory to decode 49 frames (6 seconds of video at 8 FPS) with output resolution 720x480 (W x H), which makes it not possible to run on consumer GPUs or free-tier T4 Colab. The following memory optimizations could be used to reduce the memory footprint. For replication, you can refer to <a href="https://gist.github.com/SHYuanBest/bc4207c36f454f9e969adbb50eaf8258" rel="nofollow">this</a> script.',ce,Y,Ye='<thead><tr><th align="left">Feature (overlay the previous)</th> <th align="left">Max Memory Allocated</th> <th align="left">Max Memory Reserved</th></tr></thead> <tbody><tr><td align="left">-</td> <td align="left">37 GB</td> <td align="left">44 GB</td></tr> <tr><td align="left">enable_model_cpu_offload</td> <td align="left">22 GB</td> <td align="left">25 GB</td></tr> <tr><td align="left">enable_sequential_cpu_offload</td> <td align="left">16 GB</td> <td align="left">22 GB</td></tr> <tr><td align="left">vae.enable_slicing</td> <td align="left">16 GB</td> <td align="left">22 GB</td></tr> <tr><td align="left">vae.enable_tiling</td> <td align="left">5 GB</td> <td align="left">7 GB</td></tr></tbody>',me,X,fe,f,V,Te,Q,Xe="Pipeline for image-to-video generation using ConsisID.",Ie,q,Ve=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. 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.)`,je,j,R,Je,A,Re="Function invoked when calling the pipeline for generation.",Ce,U,Ze,x,H,Ue,O,He="Encodes the prompt into text encoder hidden states.",he,F,ue,J,z,xe,K,Fe="Output class for ConsisID pipelines.",ge,L,_e,te,ye;return g=new ve({props:{title:"ConsisID",local:"consisid",headingTag:"h1"}}),Z=new Ae({props:{$$slots:{default:[tt]},$$scope:{ctx:S}}}),$=new ve({props:{title:"Memory optimization",local:"memory-optimization",headingTag:"h3"}}),X=new ve({props:{title:"ConsisIDPipeline",local:"diffusers.ConsisIDPipeline",headingTag:"h2"}}),V=new we({props:{name:"class diffusers.ConsisIDPipeline",anchor:"diffusers.ConsisIDPipeline",parameters:[{name:"tokenizer",val:": T5Tokenizer"},{name:"text_encoder",val:": T5EncoderModel"},{name:"vae",val:": AutoencoderKLCogVideoX"},{name:"transformer",val:": ConsisIDTransformer3DModel"},{name:"scheduler",val:": CogVideoXDPMScheduler"}],parametersDescription:[{anchor:"diffusers.ConsisIDPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode videos to and from latent representations.`,name:"vae"},{anchor:"diffusers.ConsisIDPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>T5EncoderModel</code>) &#x2014;
Frozen text-encoder. ConsisID uses
<a href="https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>; specifically the
<a href="https://huggingface.co/PixArt-alpha/PixArt-alpha/tree/main/t5-v1_1-xxl" rel="nofollow">t5-v1_1-xxl</a> variant.`,name:"text_encoder"},{anchor:"diffusers.ConsisIDPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>T5Tokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5Tokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.ConsisIDPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/main/en/api/models/consisid_transformer3d#diffusers.ConsisIDTransformer3DModel">ConsisIDTransformer3DModel</a>) &#x2014;
A text conditioned <code>ConsisIDTransformer3DModel</code> to denoise the encoded video latents.`,name:"transformer"},{anchor:"diffusers.ConsisIDPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded video latents.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/consisid/pipeline_consisid.py#L250"}}),R=new we({props:{name:"__call__",anchor:"diffusers.ConsisIDPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]]"},{name:"prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": int = 480"},{name:"width",val:": int = 720"},{name:"num_frames",val:": int = 49"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 6.0"},{name:"use_dynamic_cfg",val:": bool = False"},{name:"num_videos_per_prompt",val:": int = 1"},{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:": str = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 226"},{name:"id_vit_hidden",val:": typing.Optional[torch.Tensor] = None"},{name:"id_cond",val:": typing.Optional[torch.Tensor] = None"},{name:"kps_cond",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"diffusers.ConsisIDPipeline.__call__.image",description:`<strong>image</strong> (<code>PipelineImageInput</code>) &#x2014;
The input image to condition the generation on. Must be an image, a list of images or a <code>torch.Tensor</code>.`,name:"image"},{anchor:"diffusers.ConsisIDPipeline.__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 image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.ConsisIDPipeline.__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 image 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.ConsisIDPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.transformer.config.sample_height * self.vae_scale_factor_spatial) &#x2014;
The height in pixels of the generated image. This is set to 480 by default for the best results.`,name:"height"},{anchor:"diffusers.ConsisIDPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.transformer.config.sample_height * self.vae_scale_factor_spatial) &#x2014;
The width in pixels of the generated image. This is set to 720 by default for the best results.`,name:"width"},{anchor:"diffusers.ConsisIDPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>49</code>) &#x2014;
Number of frames to generate. Must be divisible by self.vae_scale_factor_temporal. Generated video will
contain 1 extra frame because ConsisID is conditioned with (num_seconds * fps + 1) frames where
num_seconds is 6 and fps is 4. However, since videos can be saved at any fps, the only condition that
needs to be satisfied is that of divisibility mentioned above.`,name:"num_frames"},{anchor:"diffusers.ConsisIDPipeline.__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 image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.ConsisIDPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 6) &#x2014;
Guidance scale as defined in <a href="https://huggingface.co/papers/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://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting
<code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to
the text <code>prompt</code>, usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.ConsisIDPipeline.__call__.use_dynamic_cfg",description:`<strong>use_dynamic_cfg</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If True, dynamically adjusts the guidance scale during inference. This allows the model to use a
progressive guidance scale, improving the balance between text-guided generation and image quality over
the course of the inference steps. Typically, early inference steps use a higher guidance scale for
more faithful image generation, while later steps reduce it for more diverse and natural results.`,name:"use_dynamic_cfg"},{anchor:"diffusers.ConsisIDPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of videos to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.ConsisIDPipeline.__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.ConsisIDPipeline.__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 image
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>.`,name:"latents"},{anchor:"diffusers.ConsisIDPipeline.__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.ConsisIDPipeline.__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.ConsisIDPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.ConsisIDPipeline.__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_xl.StableDiffusionXLPipelineOutput</code> instead
of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.ConsisIDPipeline.__call__.attention_kwargs",description:`<strong>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/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.ConsisIDPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a list of all tensors as specified by
<code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.ConsisIDPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.ConsisIDPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>226</code>) &#x2014;
Maximum sequence length in encoded prompt. Must be consistent with
<code>self.transformer.config.max_text_seq_length</code> otherwise may lead to poor results.`,name:"max_sequence_length"},{anchor:"diffusers.ConsisIDPipeline.__call__.id_vit_hidden",description:`<strong>id_vit_hidden</strong> (<code>Optional[torch.Tensor]</code>, <em>optional</em>) &#x2014;
The tensor representing the hidden features extracted from the face model, which are used to condition
the local facial extractor. This is crucial for the model to obtain high-frequency information of the
face. If not provided, the local facial extractor will not run normally.`,name:"id_vit_hidden"},{anchor:"diffusers.ConsisIDPipeline.__call__.id_cond",description:`<strong>id_cond</strong> (<code>Optional[torch.Tensor]</code>, <em>optional</em>) &#x2014;
The tensor representing the hidden features extracted from the clip model, which are used to condition
the local facial extractor. This is crucial for the model to edit facial features If not provided, the
local facial extractor will not run normally.`,name:"id_cond"},{anchor:"diffusers.ConsisIDPipeline.__call__.kps_cond",description:`<strong>kps_cond</strong> (<code>Optional[torch.Tensor]</code>, <em>optional</em>) &#x2014;
A tensor that determines whether the global facial extractor use keypoint information for conditioning.
If provided, this tensor controls whether facial keypoints such as eyes, nose, and mouth landmarks are
used during the generation process. This helps ensure the model retains more facial low-frequency
information.`,name:"kps_cond"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/consisid/pipeline_consisid.py#L661",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/pipelines/consisid#diffusers.pipelines.consisid.pipeline_output.ConsisIDPipelineOutput"
>ConsisIDPipelineOutput</a> if <code>return_dict</code> is True, otherwise a
<code>tuple</code>. When returning a tuple, the first element is a list with the generated images.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/pipelines/consisid#diffusers.pipelines.consisid.pipeline_output.ConsisIDPipelineOutput"
>ConsisIDPipelineOutput</a> or <code>tuple</code></p>
`}}),U=new Ke({props:{anchor:"diffusers.ConsisIDPipeline.__call__.example",$$slots:{default:[nt]},$$scope:{ctx:S}}}),H=new we({props:{name:"encode_prompt",anchor:"diffusers.ConsisIDPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int = 226"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.ConsisIDPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.ConsisIDPipeline.encode_prompt.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 image 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.ConsisIDPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use classifier free guidance or not.`,name:"do_classifier_free_guidance"},{anchor:"diffusers.ConsisIDPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of videos that should be generated per prompt. torch device to place the resulting embeddings on`,name:"num_videos_per_prompt"},{anchor:"diffusers.ConsisIDPipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</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.ConsisIDPipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</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.ConsisIDPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device`,name:"device"},{anchor:"diffusers.ConsisIDPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> &#x2014; (<code>torch.dtype</code>, <em>optional</em>):
torch dtype`,name:"dtype"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/consisid/pipeline_consisid.py#L355"}}),F=new ve({props:{title:"ConsisIDPipelineOutput",local:"diffusers.pipelines.consisid.pipeline_output.ConsisIDPipelineOutput",headingTag:"h2"}}),z=new we({props:{name:"class diffusers.pipelines.consisid.pipeline_output.ConsisIDPipelineOutput",anchor:"diffusers.pipelines.consisid.pipeline_output.ConsisIDPipelineOutput",parameters:[{name:"frames",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.pipelines.consisid.pipeline_output.ConsisIDPipelineOutput.frames",description:`<strong>frames</strong> (<code>torch.Tensor</code>, <code>np.ndarray</code>, or List[List[PIL.Image.Image]]) &#x2014;
List of video outputs - It can be a nested list of length <code>batch_size,</code> with each sub-list containing
denoised PIL image sequences of length <code>num_frames.</code> It can also be a NumPy array or Torch tensor of shape
<code>(batch_size, num_frames, channels, height, width)</code>.`,name:"frames"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/consisid/pipeline_output.py#L8"}}),L=new et({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/consisid.md"}}),{c(){a=l("meta"),I=o(),p=l("p"),h=o(),y(g.$$.fragment),d=o(),_=l("div"),_.innerHTML=Ge,ne=o(),G=l("p"),G.innerHTML=ke,se=o(),k=l("p"),k.textContent=Be,oe=o(),B=l("p"),B.innerHTML=De,ie=o(),y(Z.$$.fragment),ae=o(),D=l("p"),D.innerHTML=We,le=o(),W=l("p"),W.textContent=Pe,re=o(),P=l("table"),P.innerHTML=$e,de=o(),y($.$$.fragment),pe=o(),N=l("p"),N.innerHTML=Ne,ce=o(),Y=l("table"),Y.innerHTML=Ye,me=o(),y(X.$$.fragment),fe=o(),f=l("div"),y(V.$$.fragment),Te=o(),Q=l("p"),Q.textContent=Xe,Ie=o(),q=l("p"),q.innerHTML=Ve,je=o(),j=l("div"),y(R.$$.fragment),Je=o(),A=l("p"),A.textContent=Re,Ce=o(),y(U.$$.fragment),Ze=o(),x=l("div"),y(H.$$.fragment),Ue=o(),O=l("p"),O.textContent=He,he=o(),y(F.$$.fragment),ue=o(),J=l("div"),y(z.$$.fragment),xe=o(),K=l("p"),K.textContent=Fe,ge=o(),y(L.$$.fragment),_e=o(),te=l("p"),this.h()},l(e){const t=qe("svelte-u9bgzb",document.head);a=r(t,"META",{name:!0,content:!0}),t.forEach(n),I=i(e),p=r(e,"P",{}),ee(p).forEach(n),h=i(e),b(g.$$.fragment,e),d=i(e),_=r(e,"DIV",{class:!0,"data-svelte-h":!0}),m(_)!=="svelte-si9ct8"&&(_.innerHTML=Ge),ne=i(e),G=r(e,"P",{"data-svelte-h":!0}),m(G)!=="svelte-1okft15"&&(G.innerHTML=ke),se=i(e),k=r(e,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1cwsb16"&&(k.textContent=Be),oe=i(e),B=r(e,"P",{"data-svelte-h":!0}),m(B)!=="svelte-16o3b9f"&&(B.innerHTML=De),ie=i(e),b(Z.$$.fragment,e),ae=i(e),D=r(e,"P",{"data-svelte-h":!0}),m(D)!=="svelte-508pas"&&(D.innerHTML=We),le=i(e),W=r(e,"P",{"data-svelte-h":!0}),m(W)!=="svelte-10ua0j4"&&(W.textContent=Pe),re=i(e),P=r(e,"TABLE",{"data-svelte-h":!0}),m(P)!=="svelte-1g40pp0"&&(P.innerHTML=$e),de=i(e),b($.$$.fragment,e),pe=i(e),N=r(e,"P",{"data-svelte-h":!0}),m(N)!=="svelte-l3wq5l"&&(N.innerHTML=Ne),ce=i(e),Y=r(e,"TABLE",{"data-svelte-h":!0}),m(Y)!=="svelte-i2ot8w"&&(Y.innerHTML=Ye),me=i(e),b(X.$$.fragment,e),fe=i(e),f=r(e,"DIV",{class:!0});var u=ee(f);b(V.$$.fragment,u),Te=i(u),Q=r(u,"P",{"data-svelte-h":!0}),m(Q)!=="svelte-1ypyl48"&&(Q.textContent=Xe),Ie=i(u),q=r(u,"P",{"data-svelte-h":!0}),m(q)!=="svelte-wu1jmh"&&(q.innerHTML=Ve),je=i(u),j=r(u,"DIV",{class:!0});var C=ee(j);b(R.$$.fragment,C),Je=i(C),A=r(C,"P",{"data-svelte-h":!0}),m(A)!=="svelte-v78lg8"&&(A.textContent=Re),Ce=i(C),b(U.$$.fragment,C),C.forEach(n),Ze=i(u),x=r(u,"DIV",{class:!0});var be=ee(x);b(H.$$.fragment,be),Ue=i(be),O=r(be,"P",{"data-svelte-h":!0}),m(O)!=="svelte-16q0ax1"&&(O.textContent=He),be.forEach(n),u.forEach(n),he=i(e),b(F.$$.fragment,e),ue=i(e),J=r(e,"DIV",{class:!0});var Me=ee(J);b(z.$$.fragment,Me),xe=i(Me),K=r(Me,"P",{"data-svelte-h":!0}),m(K)!=="svelte-ihv7pb"&&(K.textContent=Fe),Me.forEach(n),ge=i(e),b(L.$$.fragment,e),_e=i(e),te=r(e,"P",{}),ee(te).forEach(n),this.h()},h(){E(a,"name","hf:doc:metadata"),E(a,"content",ot),E(_,"class","flex flex-wrap space-x-1"),E(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(J,"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,t){c(document.head,a),s(e,I,t),s(e,p,t),s(e,h,t),M(g,e,t),s(e,d,t),s(e,_,t),s(e,ne,t),s(e,G,t),s(e,se,t),s(e,k,t),s(e,oe,t),s(e,B,t),s(e,ie,t),M(Z,e,t),s(e,ae,t),s(e,D,t),s(e,le,t),s(e,W,t),s(e,re,t),s(e,P,t),s(e,de,t),M($,e,t),s(e,pe,t),s(e,N,t),s(e,ce,t),s(e,Y,t),s(e,me,t),M(X,e,t),s(e,fe,t),s(e,f,t),M(V,f,null),c(f,Te),c(f,Q),c(f,Ie),c(f,q),c(f,je),c(f,j),M(R,j,null),c(j,Je),c(j,A),c(j,Ce),M(U,j,null),c(f,Ze),c(f,x),M(H,x,null),c(x,Ue),c(x,O),s(e,he,t),M(F,e,t),s(e,ue,t),s(e,J,t),M(z,J,null),c(J,xe),c(J,K),s(e,ge,t),M(L,e,t),s(e,_e,t),s(e,te,t),ye=!0},p(e,[t]){const u={};t&2&&(u.$$scope={dirty:t,ctx:e}),Z.$set(u);const C={};t&2&&(C.$$scope={dirty:t,ctx:e}),U.$set(C)},i(e){ye||(w(g.$$.fragment,e),w(Z.$$.fragment,e),w($.$$.fragment,e),w(X.$$.fragment,e),w(V.$$.fragment,e),w(R.$$.fragment,e),w(U.$$.fragment,e),w(H.$$.fragment,e),w(F.$$.fragment,e),w(z.$$.fragment,e),w(L.$$.fragment,e),ye=!0)},o(e){v(g.$$.fragment,e),v(Z.$$.fragment,e),v($.$$.fragment,e),v(X.$$.fragment,e),v(V.$$.fragment,e),v(R.$$.fragment,e),v(U.$$.fragment,e),v(H.$$.fragment,e),v(F.$$.fragment,e),v(z.$$.fragment,e),v(L.$$.fragment,e),ye=!1},d(e){e&&(n(I),n(p),n(h),n(d),n(_),n(ne),n(G),n(se),n(k),n(oe),n(B),n(ie),n(ae),n(D),n(le),n(W),n(re),n(P),n(de),n(pe),n(N),n(ce),n(Y),n(me),n(fe),n(f),n(he),n(ue),n(J),n(ge),n(_e),n(te)),n(a),T(g,e),T(Z,e),T($,e),T(X,e),T(V),T(R),T(U),T(H),T(F,e),T(z),T(L,e)}}}const ot='{"title":"ConsisID","local":"consisid","sections":[{"title":"Memory optimization","local":"memory-optimization","sections":[],"depth":3},{"title":"ConsisIDPipeline","local":"diffusers.ConsisIDPipeline","sections":[],"depth":2},{"title":"ConsisIDPipelineOutput","local":"diffusers.pipelines.consisid.pipeline_output.ConsisIDPipelineOutput","sections":[],"depth":2}],"depth":1}';function it(S){return Ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ft extends Se{constructor(a){super(),Qe(this,a,it,st,Le,{})}}export{ft as component};
