import{s as Le,o as Ee,n as Se}from"../chunks/scheduler.53228c21.js";import{S as qe,i as Qe,e as a,s as o,c as _,h as Ae,a as l,d as n,b as i,f as K,g as y,j as p,k as U,l as c,m as s,n as b,t as M,o as w,p as v}from"../chunks/index.100fac89.js";import{D as we}from"../chunks/Docstring.49101787.js";import{C as Oe}from"../chunks/CodeBlock.d30a6509.js";import{E as Ke}from"../chunks/ExampleCodeBlock.4a9effb9.js";import{H as ve,E as et}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4d82655d.js";function tt(te){let d,x="Examples:",T,h,u;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(){d=a("p"),d.textContent=x,T=o(),_(h.$$.fragment)},l(r){d=l(r,"P",{"data-svelte-h":!0}),p(d)!=="svelte-kvfsh7"&&(d.textContent=x),T=i(r),y(h.$$.fragment,r)},m(r,g){s(r,d,g),s(r,T,g),b(h,r,g),u=!0},p:Se,i(r){u||(M(h.$$.fragment,r),u=!0)},o(r){w(h.$$.fragment,r),u=!1},d(r){r&&(n(d),n(T)),v(h,r)}}}function nt(te){let d,x,T,h,u,r,g,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,J,We='<p>Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading#reuse-a-pipeline">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.</p>',ae,D,Pe='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,Ne="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,N,ce,$,Ye='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.',pe,Y,Xe='<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,m,V,Te,E,Ve="Pipeline for image-to-video generation using ConsisID.",Ie,S,Re=`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,I,R,Je,q,He="Function invoked when calling the pipeline for generation.",Ce,C,Ze,Z,H,Ue,Q,Fe="Encodes the prompt into text encoder hidden states.",he,F,ue,j,z,xe,A,ze="Output class for ConsisID pipelines.",ge,L,_e,ee,ye;return u=new ve({props:{title:"ConsisID",local:"consisid",headingTag:"h1"}}),N=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 be 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>
`}}),C=new Ke({props:{anchor:"diffusers.ConsisIDPipeline.__call__.example",$$slots:{default:[tt]},$$scope:{ctx:te}}}),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#L9"}}),L=new et({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/consisid.md"}}),{c(){d=a("meta"),x=o(),T=a("p"),h=o(),_(u.$$.fragment),r=o(),g=a("div"),g.innerHTML=Ge,ne=o(),G=a("p"),G.innerHTML=ke,se=o(),k=a("p"),k.textContent=Be,oe=o(),B=a("p"),B.innerHTML=De,ie=o(),J=a("blockquote"),J.innerHTML=We,ae=o(),D=a("p"),D.innerHTML=Pe,le=o(),W=a("p"),W.textContent=Ne,re=o(),P=a("table"),P.innerHTML=$e,de=o(),_(N.$$.fragment),ce=o(),$=a("p"),$.innerHTML=Ye,pe=o(),Y=a("table"),Y.innerHTML=Xe,me=o(),_(X.$$.fragment),fe=o(),m=a("div"),_(V.$$.fragment),Te=o(),E=a("p"),E.textContent=Ve,Ie=o(),S=a("p"),S.innerHTML=Re,je=o(),I=a("div"),_(R.$$.fragment),Je=o(),q=a("p"),q.textContent=He,Ce=o(),_(C.$$.fragment),Ze=o(),Z=a("div"),_(H.$$.fragment),Ue=o(),Q=a("p"),Q.textContent=Fe,he=o(),_(F.$$.fragment),ue=o(),j=a("div"),_(z.$$.fragment),xe=o(),A=a("p"),A.textContent=ze,ge=o(),_(L.$$.fragment),_e=o(),ee=a("p"),this.h()},l(e){const t=Ae("svelte-u9bgzb",document.head);d=l(t,"META",{name:!0,content:!0}),t.forEach(n),x=i(e),T=l(e,"P",{}),K(T).forEach(n),h=i(e),y(u.$$.fragment,e),r=i(e),g=l(e,"DIV",{class:!0,"data-svelte-h":!0}),p(g)!=="svelte-si9ct8"&&(g.innerHTML=Ge),ne=i(e),G=l(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-1okft15"&&(G.innerHTML=ke),se=i(e),k=l(e,"P",{"data-svelte-h":!0}),p(k)!=="svelte-1cwsb16"&&(k.textContent=Be),oe=i(e),B=l(e,"P",{"data-svelte-h":!0}),p(B)!=="svelte-16o3b9f"&&(B.innerHTML=De),ie=i(e),J=l(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),p(J)!=="svelte-r1jcqf"&&(J.innerHTML=We),ae=i(e),D=l(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-508pas"&&(D.innerHTML=Pe),le=i(e),W=l(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-10ua0j4"&&(W.textContent=Ne),re=i(e),P=l(e,"TABLE",{"data-svelte-h":!0}),p(P)!=="svelte-1g40pp0"&&(P.innerHTML=$e),de=i(e),y(N.$$.fragment,e),ce=i(e),$=l(e,"P",{"data-svelte-h":!0}),p($)!=="svelte-l3wq5l"&&($.innerHTML=Ye),pe=i(e),Y=l(e,"TABLE",{"data-svelte-h":!0}),p(Y)!=="svelte-i2ot8w"&&(Y.innerHTML=Xe),me=i(e),y(X.$$.fragment,e),fe=i(e),m=l(e,"DIV",{class:!0});var f=K(m);y(V.$$.fragment,f),Te=i(f),E=l(f,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1ypyl48"&&(E.textContent=Ve),Ie=i(f),S=l(f,"P",{"data-svelte-h":!0}),p(S)!=="svelte-wu1jmh"&&(S.innerHTML=Re),je=i(f),I=l(f,"DIV",{class:!0});var O=K(I);y(R.$$.fragment,O),Je=i(O),q=l(O,"P",{"data-svelte-h":!0}),p(q)!=="svelte-v78lg8"&&(q.textContent=He),Ce=i(O),y(C.$$.fragment,O),O.forEach(n),Ze=i(f),Z=l(f,"DIV",{class:!0});var be=K(Z);y(H.$$.fragment,be),Ue=i(be),Q=l(be,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-16q0ax1"&&(Q.textContent=Fe),be.forEach(n),f.forEach(n),he=i(e),y(F.$$.fragment,e),ue=i(e),j=l(e,"DIV",{class:!0});var Me=K(j);y(z.$$.fragment,Me),xe=i(Me),A=l(Me,"P",{"data-svelte-h":!0}),p(A)!=="svelte-ihv7pb"&&(A.textContent=ze),Me.forEach(n),ge=i(e),y(L.$$.fragment,e),_e=i(e),ee=l(e,"P",{}),K(ee).forEach(n),this.h()},h(){U(d,"name","hf:doc:metadata"),U(d,"content",st),U(g,"class","flex flex-wrap space-x-1"),U(J,"class","tip"),U(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(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,d),s(e,x,t),s(e,T,t),s(e,h,t),b(u,e,t),s(e,r,t),s(e,g,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),s(e,J,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),b(N,e,t),s(e,ce,t),s(e,$,t),s(e,pe,t),s(e,Y,t),s(e,me,t),b(X,e,t),s(e,fe,t),s(e,m,t),b(V,m,null),c(m,Te),c(m,E),c(m,Ie),c(m,S),c(m,je),c(m,I),b(R,I,null),c(I,Je),c(I,q),c(I,Ce),b(C,I,null),c(m,Ze),c(m,Z),b(H,Z,null),c(Z,Ue),c(Z,Q),s(e,he,t),b(F,e,t),s(e,ue,t),s(e,j,t),b(z,j,null),c(j,xe),c(j,A),s(e,ge,t),b(L,e,t),s(e,_e,t),s(e,ee,t),ye=!0},p(e,[t]){const f={};t&2&&(f.$$scope={dirty:t,ctx:e}),C.$set(f)},i(e){ye||(M(u.$$.fragment,e),M(N.$$.fragment,e),M(X.$$.fragment,e),M(V.$$.fragment,e),M(R.$$.fragment,e),M(C.$$.fragment,e),M(H.$$.fragment,e),M(F.$$.fragment,e),M(z.$$.fragment,e),M(L.$$.fragment,e),ye=!0)},o(e){w(u.$$.fragment,e),w(N.$$.fragment,e),w(X.$$.fragment,e),w(V.$$.fragment,e),w(R.$$.fragment,e),w(C.$$.fragment,e),w(H.$$.fragment,e),w(F.$$.fragment,e),w(z.$$.fragment,e),w(L.$$.fragment,e),ye=!1},d(e){e&&(n(x),n(T),n(h),n(r),n(g),n(ne),n(G),n(se),n(k),n(oe),n(B),n(ie),n(J),n(ae),n(D),n(le),n(W),n(re),n(P),n(de),n(ce),n($),n(pe),n(Y),n(me),n(fe),n(m),n(he),n(ue),n(j),n(ge),n(_e),n(ee)),n(d),v(u,e),v(N,e),v(X,e),v(V),v(R),v(C),v(H),v(F,e),v(z),v(L,e)}}}const st='{"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 ot(te){return Ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pt extends qe{constructor(d){super(),Qe(this,d,ot,nt,Le,{})}}export{pt as component};
