import{s as ke,o as Ne,n as De}from"../chunks/scheduler.8c3d61f6.js";import{S as He,i as Pe,g as l,s as a,r as y,A as Ie,h as d,f as n,c as r,j as Q,u as b,x as g,k as X,y as u,a as i,v,d as C,t as x,w}from"../chunks/index.589a98e8.js";import{T as Ee}from"../chunks/Tip.42aa8582.js";import{D as ge}from"../chunks/Docstring.27406313.js";import{C as $e}from"../chunks/CodeBlock.36627b28.js";import{E as Be}from"../chunks/ExampleCodeBlock.3dc467a7.js";import{H as Me,E as je}from"../chunks/EditOnGithub.e5a8d9cb.js";function Ge(W){let o,J='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-components-across-pipelines">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.';return{c(){o=l("p"),o.innerHTML=J},l(p){o=d(p,"P",{"data-svelte-h":!0}),g(o)!=="svelte-1wmc0l4"&&(o.innerHTML=J)},m(p,_){i(p,o,_)},p:De,d(p){p&&n(o)}}}function Ze(W){let o,J="Examples:",p,_,f;return _=new $e({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEh1bnl1YW5EaVQyRENvbnRyb2xOZXRNb2RlbCUyQyUyMEh1bnl1YW5EaVRDb250cm9sTmV0UGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQWNvbnRyb2xuZXQlMjAlM0QlMjBIdW55dWFuRGlUMkRDb250cm9sTmV0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMlRlbmNlbnQtSHVueXVhbiUyRkh1bnl1YW5EaVQtdjEuMS1Db250cm9sTmV0LURpZmZ1c2Vycy1DYW5ueSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEElMEFwaXBlJTIwJTNEJTIwSHVueXVhbkRpVENvbnRyb2xOZXRQaXBlbGluZS5mcm9tX3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c2Utc3R5bGUlMjBsaW9uJTIwc3RhdHVlJTIwc3RhbmRzJTIwaW4lMjBmcm9udCUyMG9mJTIwdGhlJTIwaG90ZWwlMkMlMjBpdHMlMjBleWVzJTIwZ2xlYW1pbmclMjBhcyUyMGlmJTIwZ3VhcmRpbmclMjB0aGUlMjBidWlsZGluZy4lMjBUaGUlMjBiYWNrZ3JvdW5kJTIwaXMlMjB0aGUlMjBob3RlbCUyMGVudHJhbmNlJTIwYXQlMjBuaWdodCUyQyUyMHdpdGglMjBhJTIwY2xvc2UtdXAlMkMlMjBleWUtbGV2ZWwlMkMlMjBhbmQlMjBjZW50ZXJlZCUyMGNvbXBvc2l0aW9uLiUyMFRoaXMlMjBwaG90byUyMHByZXNlbnRzJTIwYSUyMHJlYWxpc3RpYyUyMHBob3RvZ3JhcGhpYyUyMHN0eWxlJTJDJTIwZW1ib2RpZXMlMjBDaGluZXNlJTIwc2N1bHB0dXJlJTIwY3VsdHVyZSUyQyUyMGFuZCUyMHJldmVhbHMlMjBhJTIwbXlzdGVyaW91cyUyMGF0bW9zcGhlcmUuJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDEwMjQlMkMlMEElMjAlMjAlMjAlMjBjb250cm9sX2ltYWdlJTNEY29uZF9pbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> HunyuanDiT2DControlNetModel, HunyuanDiTControlNetPipeline
<span class="hljs-keyword">import</span> torch

controlnet = HunyuanDiT2DControlNetModel.from_pretrained(
    <span class="hljs-string">&quot;Tencent-Hunyuan/HunyuanDiT-v1.1-ControlNet-Diffusers-Canny&quot;</span>, torch_dtype=torch.float16
)

pipe = HunyuanDiTControlNetPipeline.from_pretrained(
    <span class="hljs-string">&quot;Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers&quot;</span>, controlnet=controlnet, torch_dtype=torch.float16
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

cond_image = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/Tencent-Hunyuan/HunyuanDiT-v1.1-ControlNet-Diffusers-Canny/resolve/main/canny.jpg?download=true&quot;</span>
)

<span class="hljs-comment">## You may also use English prompt as HunyuanDiT supports both English and Chinese</span>
prompt = <span class="hljs-string">&quot;在夜晚的酒店门前，一座古老的中国风格的狮子雕像矗立着，它的眼睛闪烁着光芒，仿佛在守护着这座建筑。背景是夜晚的酒店前，构图方式是特写，平视，居中构图。这张照片呈现了真实摄影风格，蕴含了中国雕塑文化，同时展现了神秘氛围&quot;</span>
<span class="hljs-comment"># prompt=&quot;At night, an ancient Chinese-style lion statue stands in front of the hotel, its eyes gleaming as if guarding the building. The background is the hotel entrance at night, with a close-up, eye-level, and centered composition. This photo presents a realistic photographic style, embodies Chinese sculpture culture, and reveals a mysterious atmosphere.&quot;</span>
image = pipe(
    prompt,
    height=<span class="hljs-number">1024</span>,
    width=<span class="hljs-number">1024</span>,
    control_image=cond_image,
    num_inference_steps=<span class="hljs-number">50</span>,
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){o=l("p"),o.textContent=J,p=a(),y(_.$$.fragment)},l(s){o=d(s,"P",{"data-svelte-h":!0}),g(o)!=="svelte-kvfsh7"&&(o.textContent=J),p=r(s),b(_.$$.fragment,s)},m(s,h){i(s,o,h),i(s,p,h),v(_,s,h),f=!0},p:De,i(s){f||(C(_.$$.fragment,s),f=!0)},o(s){x(_.$$.fragment,s),f=!1},d(s){s&&(n(o),n(p)),w(_,s)}}}function We(W){let o,J,p,_,f,s,h,fe='HunyuanDiTControlNetPipeline is an implementation of ControlNet for <a href="https://arxiv.org/abs/2405.08748" rel="nofollow">Hunyuan-DiT</a>.',O,N,he='ControlNet was introduced in <a href="https://huggingface.co/papers/2302.05543" rel="nofollow">Adding Conditional Control to Text-to-Image Diffusion Models</a> by Lvmin Zhang, Anyi Rao, and Maneesh Agrawala.',A,H,Je="With a ControlNet model, you can provide an additional control image to condition and control Hunyuan-DiT generation. For example, if you provide a depth map, the ControlNet model generates an image that’ll preserve the spatial information from the depth map. It is a more flexible and accurate way to control the image generation process.",q,P,Ue="The abstract from the paper is:",Y,I,Te="<em>We present ControlNet, a neural network architecture to add spatial conditioning controls to large, pretrained text-to-image diffusion models. ControlNet locks the production-ready large diffusion models, and reuses their deep and robust encoding layers pretrained with billions of images as a strong backbone to learn a diverse set of conditional controls. The neural architecture is connected with “zero convolutions” (zero-initialized convolution layers) that progressively grow the parameters from zero and ensure that no harmful noise could affect the finetuning. We test various conditioning controls, eg, edges, depth, segmentation, human pose, etc, with Stable Diffusion, using single or multiple conditions, with or without prompts. We show that the training of ControlNets is robust with small (&lt;50k) and large (&gt;1m) datasets. Extensive results show that ControlNet may facilitate wider applications to control image diffusion models.</em>",K,E,ye='This code is implemented by Tencent Hunyuan Team. You can find pre-trained checkpoints for Hunyuan-DiT ControlNets on <a href="https://huggingface.co/Tencent-Hunyuan" rel="nofollow">Tencent Hunyuan</a>.',ee,M,te,$,ne,c,B,se,z,be="Pipeline for English/Chinese-to-image generation using HunyuanDiT.",le,L,ve=`This model inherits from <a href="/docs/diffusers/pr_8406/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.)`,de,V,Ce=`HunyuanDiT uses two text encoders: <a href="https://huggingface.co/google/mt5-base" rel="nofollow">mT5</a> and [bilingual CLIP](fine-tuned by
ourselves)`,ce,U,j,pe,R,xe="The call function to the pipeline for generation with HunyuanDiT.",ue,D,me,k,G,_e,F,we="Encodes the prompt into text encoder hidden states.",oe,Z,ie,S,ae;return f=new Me({props:{title:"ControlNet with Hunyuan-DiT",local:"controlnet-with-hunyuan-dit",headingTag:"h1"}}),M=new Ee({props:{$$slots:{default:[Ge]},$$scope:{ctx:W}}}),$=new Me({props:{title:"HunyuanDiTControlNetPipeline",local:"diffusers.HunyuanDiTControlNetPipeline",headingTag:"h2"}}),B=new ge({props:{name:"class diffusers.HunyuanDiTControlNetPipeline",anchor:"diffusers.HunyuanDiTControlNetPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": BertModel"},{name:"tokenizer",val:": BertTokenizer"},{name:"transformer",val:": HunyuanDiT2DModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"controlnet",val:": Union"},{name:"text_encoder_2",val:" = <class 'transformers.models.t5.modeling_t5.T5EncoderModel'>"},{name:"tokenizer_2",val:" = <class 'transformers.models.t5.tokenization_t5.T5Tokenizer'>"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.HunyuanDiTControlNetPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_8406/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations. We use
<code>sdxl-vae-fp16-fix</code>.`,name:"vae"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.text_encoder",description:`<strong>text_encoder</strong> (Optional[<code>~transformers.BertModel</code>, <code>~transformers.CLIPTextModel</code>]) &#x2014;
Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).
HunyuanDiT uses a fine-tuned [bilingual CLIP].`,name:"text_encoder"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.tokenizer",description:`<strong>tokenizer</strong> (Optional[<code>~transformers.BertTokenizer</code>, <code>~transformers.CLIPTokenizer</code>]) &#x2014;
A <code>BertTokenizer</code> or <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/pr_8406/en/api/models/hunyuan_transformer2d#diffusers.HunyuanDiT2DModel">HunyuanDiT2DModel</a>) &#x2014;
The HunyuanDiT model designed by Tencent Hunyuan.`,name:"transformer"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.text_encoder_2",description:`<strong>text_encoder_2</strong> (<code>T5EncoderModel</code>) &#x2014;
The mT5 embedder. Specifically, it is &#x2018;t5-v1_1-xxl&#x2019;.`,name:"text_encoder_2"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.tokenizer_2",description:`<strong>tokenizer_2</strong> (<code>MT5Tokenizer</code>) &#x2014;
The tokenizer for the mT5 embedder.`,name:"tokenizer_2"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_8406/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>) &#x2014;
A scheduler to be used in combination with HunyuanDiT to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.controlnet",description:`<strong>controlnet</strong> (<a href="/docs/diffusers/pr_8406/en/api/models/controlnet_hunyuandit#diffusers.HunyuanDiT2DControlNetModel">HunyuanDiT2DControlNetModel</a> or <code>List[HunyuanDiT2DControlNetModel]</code> or <a href="/docs/diffusers/pr_8406/en/api/models/controlnet_hunyuandit#diffusers.HunyuanDiT2DControlNetModel">HunyuanDiT2DControlNetModel</a>) &#x2014;
Provides additional conditioning to the <code>unet</code> during the denoising process. If you set multiple
ControlNets as a list, the outputs from each ControlNet are added together to create one combined
additional conditioning.`,name:"controlnet"}],source:"https://github.com/huggingface/diffusers/blob/vr_8406/src/diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py#L157"}}),j=new ge({props:{name:"__call__",anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__",parameters:[{name:"prompt",val:": Union = None"},{name:"height",val:": Optional = None"},{name:"width",val:": Optional = None"},{name:"num_inference_steps",val:": Optional = 50"},{name:"guidance_scale",val:": Optional = 5.0"},{name:"control_image",val:": Union = None"},{name:"controlnet_conditioning_scale",val:": Union = 1.0"},{name:"negative_prompt",val:": Union = None"},{name:"num_images_per_prompt",val:": Optional = 1"},{name:"eta",val:": Optional = 0.0"},{name:"generator",val:": Union = None"},{name:"latents",val:": Optional = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"prompt_embeds_2",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds_2",val:": Optional = None"},{name:"prompt_attention_mask",val:": Optional = None"},{name:"prompt_attention_mask_2",val:": Optional = None"},{name:"negative_prompt_attention_mask",val:": Optional = None"},{name:"negative_prompt_attention_mask_2",val:": Optional = None"},{name:"output_type",val:": Optional = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback_on_step_end",val:": Union = None"},{name:"callback_on_step_end_tensor_inputs",val:": List = ['latents']"},{name:"guidance_rescale",val:": float = 0.0"},{name:"original_size",val:": Optional = (1024, 1024)"},{name:"target_size",val:": Optional = None"},{name:"crops_coords_top_left",val:": Tuple = (0, 0)"},{name:"use_resolution_binning",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide image generation. If not defined, you need to pass <code>prompt_embeds</code>.`,name:"prompt"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__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. This parameter is modulated by <code>strength</code>.`,name:"num_inference_steps"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.control_guidance_start",description:`<strong>control_guidance_start</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The percentage of total steps at which the ControlNet starts applying.`,name:"control_guidance_start"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.control_guidance_end",description:`<strong>control_guidance_end</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The percentage of total steps at which the ControlNet stops applying.`,name:"control_guidance_end"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.control_image",description:`<strong>control_image</strong> (<code>torch.Tensor</code>, <code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>List[torch.Tensor]</code>, <code>List[PIL.Image.Image]</code>, <code>List[np.ndarray]</code>, &#x2014;
<code>List[List[torch.Tensor]]</code>, <code>List[List[np.ndarray]]</code> or <code>List[List[PIL.Image.Image]]</code>):
The ControlNet input condition to provide guidance to the <code>unet</code> for generation. If the type is
specified as <code>torch.Tensor</code>, it is passed to ControlNet as is. <code>PIL.Image.Image</code> can also be accepted
as an image. The dimensions of the output image defaults to <code>image</code>&#x2019;s dimensions. If height and/or
width are passed, <code>image</code> is resized accordingly. If multiple ControlNets are specified in <code>init</code>,
images must be passed as a list such that each element of the list can be correctly batched for input
to a single ControlNet.`,name:"control_image"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.controlnet_conditioning_scale",description:`<strong>controlnet_conditioning_scale</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The outputs of the ControlNet are multiplied by <code>controlnet_conditioning_scale</code> before they are added
to the residual in the original <code>unet</code>. If multiple ControlNets are specified in <code>init</code>, you can set
the corresponding scale as a list.`,name:"controlnet_conditioning_scale"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass <code>negative_prompt_embeds</code> instead. Ignored when not using guidance (<code>guidance_scale &lt; 1</code>).`,name:"negative_prompt"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) from the <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">DDIM</a> paper. Only applies
to the <a href="/docs/diffusers/pr_8406/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.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 (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.prompt_embeds_2",description:`<strong>prompt_embeds_2</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds_2"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.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 (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are generated from the <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.negative_prompt_embeds_2",description:`<strong>negative_prompt_embeds_2</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are generated from the <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds_2"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.prompt_attention_mask",description:`<strong>prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for the prompt. Required when <code>prompt_embeds</code> is passed directly.`,name:"prompt_attention_mask"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.prompt_attention_mask_2",description:`<strong>prompt_attention_mask_2</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for the prompt. Required when <code>prompt_embeds_2</code> is passed directly.`,name:"prompt_attention_mask_2"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.negative_prompt_attention_mask",description:`<strong>negative_prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for the negative prompt. Required when <code>negative_prompt_embeds</code> is passed directly.`,name:"negative_prompt_attention_mask"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.negative_prompt_attention_mask_2",description:`<strong>negative_prompt_attention_mask_2</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for the negative prompt. Required when <code>negative_prompt_embeds_2</code> is passed directly.`,name:"negative_prompt_attention_mask_2"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__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 generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__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 <a href="/docs/diffusers/pr_8406/en/api/pipelines/stable_diffusion/gligen#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable[[int, int, Dict], None]</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) &#x2014;
A callback function or a list of callback functions to be called at the end of each denoising step.`,name:"callback_on_step_end"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
A list of tensor inputs that should be passed to the callback function. If not defined, all tensor
inputs will be passed.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Rescale the noise_cfg according to <code>guidance_rescale</code>. Based on findings of <a href="https://arxiv.org/pdf/2305.08891.pdf" rel="nofollow">Common Diffusion Noise
Schedules and Sample Steps are Flawed</a>. See Section 3.4`,name:"guidance_rescale"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.original_size",description:`<strong>original_size</strong> (<code>Tuple[int, int]</code>, <em>optional</em>, defaults to <code>(1024, 1024)</code>) &#x2014;
The original size of the image. Used to calculate the time ids.`,name:"original_size"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.target_size",description:`<strong>target_size</strong> (<code>Tuple[int, int]</code>, <em>optional</em>) &#x2014;
The target size of the image. Used to calculate the time ids.`,name:"target_size"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.crops_coords_top_left",description:`<strong>crops_coords_top_left</strong> (<code>Tuple[int, int]</code>, <em>optional</em>, defaults to <code>(0, 0)</code>) &#x2014;
The top left coordinates of the crop. Used to calculate the time ids.`,name:"crops_coords_top_left"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.use_resolution_binning",description:`<strong>use_resolution_binning</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use resolution binning or not. If <code>True</code>, the input resolution will be mapped to the closest
standard resolution. Supported resolutions are 1024x1024, 1280x1280, 1024x768, 1152x864, 1280x960,
768x1024, 864x1152, 960x1280, 1280x768, and 768x1280. It is recommended to set this to <code>True</code>.`,name:"use_resolution_binning"}],source:"https://github.com/huggingface/diffusers/blob/vr_8406/src/diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py#L626",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/pr_8406/en/api/pipelines/stable_diffusion/gligen#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> is returned,
otherwise a <code>tuple</code> is returned where the first element is a list with the generated images and the
second element is a list of <code>bool</code>s indicating whether the corresponding generated image contains
“not-safe-for-work” (nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/pr_8406/en/api/pipelines/stable_diffusion/gligen#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),D=new Be({props:{anchor:"diffusers.HunyuanDiTControlNetPipeline.__call__.example",$$slots:{default:[Ze]},$$scope:{ctx:W}}}),G=new ge({props:{name:"encode_prompt",anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt",parameters:[{name:"prompt",val:": str"},{name:"device",val:": device = None"},{name:"dtype",val:": dtype = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"negative_prompt",val:": Optional = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"prompt_attention_mask",val:": Optional = None"},{name:"negative_prompt_attention_mask",val:": Optional = None"},{name:"max_sequence_length",val:": Optional = None"},{name:"text_encoder_index",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded
device &#x2014; (<code>torch.device</code>):
torch device`,name:"prompt"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> (<code>torch.dtype</code>) &#x2014;
torch dtype`,name:"dtype"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>) &#x2014;
number of images that should be generated per prompt`,name:"num_images_per_prompt"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>) &#x2014;
whether to use classifier free guidance or not`,name:"do_classifier_free_guidance"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.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.HunyuanDiTControlNetPipeline.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.HunyuanDiTControlNetPipeline.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.HunyuanDiTControlNetPipeline.encode_prompt.prompt_attention_mask",description:`<strong>prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for the prompt. Required when <code>prompt_embeds</code> is passed directly.`,name:"prompt_attention_mask"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt.negative_prompt_attention_mask",description:`<strong>negative_prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Attention mask for the negative prompt. Required when <code>negative_prompt_embeds</code> is passed directly.`,name:"negative_prompt_attention_mask"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt.max_sequence_length",description:"<strong>max_sequence_length</strong> (<code>int</code>, <em>optional</em>) &#x2014; maximum sequence length to use for the prompt.",name:"max_sequence_length"},{anchor:"diffusers.HunyuanDiTControlNetPipeline.encode_prompt.text_encoder_index",description:`<strong>text_encoder_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Index of the text encoder to use. <code>0</code> for clip and <code>1</code> for T5.`,name:"text_encoder_index"}],source:"https://github.com/huggingface/diffusers/blob/vr_8406/src/diffusers/pipelines/controlnet_hunyuandit/pipeline_hunyuandit_controlnet.py#L270"}}),Z=new je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/controlnet_hunyuandit.md"}}),{c(){o=l("meta"),J=a(),p=l("p"),_=a(),y(f.$$.fragment),s=a(),h=l("p"),h.innerHTML=fe,O=a(),N=l("p"),N.innerHTML=he,A=a(),H=l("p"),H.textContent=Je,q=a(),P=l("p"),P.textContent=Ue,Y=a(),I=l("p"),I.innerHTML=Te,K=a(),E=l("p"),E.innerHTML=ye,ee=a(),y(M.$$.fragment),te=a(),y($.$$.fragment),ne=a(),c=l("div"),y(B.$$.fragment),se=a(),z=l("p"),z.textContent=be,le=a(),L=l("p"),L.innerHTML=ve,de=a(),V=l("p"),V.innerHTML=Ce,ce=a(),U=l("div"),y(j.$$.fragment),pe=a(),R=l("p"),R.textContent=xe,ue=a(),y(D.$$.fragment),me=a(),k=l("div"),y(G.$$.fragment),_e=a(),F=l("p"),F.textContent=we,oe=a(),y(Z.$$.fragment),ie=a(),S=l("p"),this.h()},l(e){const t=Ie("svelte-u9bgzb",document.head);o=d(t,"META",{name:!0,content:!0}),t.forEach(n),J=r(e),p=d(e,"P",{}),Q(p).forEach(n),_=r(e),b(f.$$.fragment,e),s=r(e),h=d(e,"P",{"data-svelte-h":!0}),g(h)!=="svelte-f4xo6c"&&(h.innerHTML=fe),O=r(e),N=d(e,"P",{"data-svelte-h":!0}),g(N)!=="svelte-1v2xz23"&&(N.innerHTML=he),A=r(e),H=d(e,"P",{"data-svelte-h":!0}),g(H)!=="svelte-w3tnjc"&&(H.textContent=Je),q=r(e),P=d(e,"P",{"data-svelte-h":!0}),g(P)!=="svelte-1cwsb16"&&(P.textContent=Ue),Y=r(e),I=d(e,"P",{"data-svelte-h":!0}),g(I)!=="svelte-fbiw6t"&&(I.innerHTML=Te),K=r(e),E=d(e,"P",{"data-svelte-h":!0}),g(E)!=="svelte-v5nvtj"&&(E.innerHTML=ye),ee=r(e),b(M.$$.fragment,e),te=r(e),b($.$$.fragment,e),ne=r(e),c=d(e,"DIV",{class:!0});var m=Q(c);b(B.$$.fragment,m),se=r(m),z=d(m,"P",{"data-svelte-h":!0}),g(z)!=="svelte-ue2deu"&&(z.textContent=be),le=r(m),L=d(m,"P",{"data-svelte-h":!0}),g(L)!=="svelte-1x72rgl"&&(L.innerHTML=ve),de=r(m),V=d(m,"P",{"data-svelte-h":!0}),g(V)!=="svelte-18ud7q1"&&(V.innerHTML=Ce),ce=r(m),U=d(m,"DIV",{class:!0});var T=Q(U);b(j.$$.fragment,T),pe=r(T),R=d(T,"P",{"data-svelte-h":!0}),g(R)!=="svelte-1jqbgbl"&&(R.textContent=xe),ue=r(T),b(D.$$.fragment,T),T.forEach(n),me=r(m),k=d(m,"DIV",{class:!0});var re=Q(k);b(G.$$.fragment,re),_e=r(re),F=d(re,"P",{"data-svelte-h":!0}),g(F)!=="svelte-16q0ax1"&&(F.textContent=we),re.forEach(n),m.forEach(n),oe=r(e),b(Z.$$.fragment,e),ie=r(e),S=d(e,"P",{}),Q(S).forEach(n),this.h()},h(){X(o,"name","hf:doc:metadata"),X(o,"content",ze),X(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),X(c,"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){u(document.head,o),i(e,J,t),i(e,p,t),i(e,_,t),v(f,e,t),i(e,s,t),i(e,h,t),i(e,O,t),i(e,N,t),i(e,A,t),i(e,H,t),i(e,q,t),i(e,P,t),i(e,Y,t),i(e,I,t),i(e,K,t),i(e,E,t),i(e,ee,t),v(M,e,t),i(e,te,t),v($,e,t),i(e,ne,t),i(e,c,t),v(B,c,null),u(c,se),u(c,z),u(c,le),u(c,L),u(c,de),u(c,V),u(c,ce),u(c,U),v(j,U,null),u(U,pe),u(U,R),u(U,ue),v(D,U,null),u(c,me),u(c,k),v(G,k,null),u(k,_e),u(k,F),i(e,oe,t),v(Z,e,t),i(e,ie,t),i(e,S,t),ae=!0},p(e,[t]){const m={};t&2&&(m.$$scope={dirty:t,ctx:e}),M.$set(m);const T={};t&2&&(T.$$scope={dirty:t,ctx:e}),D.$set(T)},i(e){ae||(C(f.$$.fragment,e),C(M.$$.fragment,e),C($.$$.fragment,e),C(B.$$.fragment,e),C(j.$$.fragment,e),C(D.$$.fragment,e),C(G.$$.fragment,e),C(Z.$$.fragment,e),ae=!0)},o(e){x(f.$$.fragment,e),x(M.$$.fragment,e),x($.$$.fragment,e),x(B.$$.fragment,e),x(j.$$.fragment,e),x(D.$$.fragment,e),x(G.$$.fragment,e),x(Z.$$.fragment,e),ae=!1},d(e){e&&(n(J),n(p),n(_),n(s),n(h),n(O),n(N),n(A),n(H),n(q),n(P),n(Y),n(I),n(K),n(E),n(ee),n(te),n(ne),n(c),n(oe),n(ie),n(S)),n(o),w(f,e),w(M,e),w($,e),w(B),w(j),w(D),w(G),w(Z,e)}}}const ze='{"title":"ControlNet with Hunyuan-DiT","local":"controlnet-with-hunyuan-dit","sections":[{"title":"HunyuanDiTControlNetPipeline","local":"diffusers.HunyuanDiTControlNetPipeline","sections":[],"depth":2}],"depth":1}';function Le(W){return Ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ae extends He{constructor(o){super(),Pe(this,o,Le,We,ke,{})}}export{Ae as component};
