import{s as ot,o as at,n as st}from"../chunks/scheduler.8c3d61f6.js";import{S as it,i as rt,g as i,s as a,r as u,A as lt,h as r,f as t,c as s,j as T,u as f,x as g,k as C,y as o,a as l,v as _,d as h,t as b,w as y}from"../chunks/index.da70eac4.js";import{D as j}from"../chunks/Docstring.367be9ed.js";import{C as pt}from"../chunks/CodeBlock.a9c4becf.js";import{E as dt}from"../chunks/ExampleCodeBlock.dd9ee828.js";import{H as Oe,E as ct}from"../chunks/getInferenceSnippets.cb466318.js";function mt(le){let m,J="Examples:",N,v,w;return v=new pt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU2FuYUNvbnRyb2xOZXRQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBJTBBcGlwZSUyMCUzRCUyMFNhbmFDb250cm9sTmV0UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmlzaGFuMjQlMkZTYW5hXzYwME1fMTAyNHB4X0NvbnRyb2xOZXRQbHVzX2RpZmZ1c2VycyUyMiUyQyUwQSUyMCUyMCUyMCUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0QlN0IlMjJkZWZhdWx0JTIyJTNBJTIwdG9yY2guYmZsb2F0MTYlMkMlMjAlMjJjb250cm9sbmV0JTIyJTNBJTIwdG9yY2guZmxvYXQxNiUyQyUyMCUyMnRyYW5zZm9ybWVyJTIyJTNBJTIwdG9yY2guZmxvYXQxNiU3RCUyQyUwQSUyMCUyMCUyMCUyMGRldmljZV9tYXAlM0QlMjJiYWxhbmNlZCUyMiUyQyUwQSklMEFjb25kX2ltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGaXNoYW4yNCUyRlNhbmFfNjAwTV8xMDI0cHhfQ29udHJvbE5ldF9kaWZmdXNlcnMlMkZyZXNvbHZlJTJGbWFpbiUyRmhlZF9leGFtcGxlLnBuZyUyMiUwQSklMEFwcm9tcHQlMjAlM0QlMjAnYSUyMGNhdCUyMHdpdGglMjBhJTIwbmVvbiUyMHNpZ24lMjB0aGF0JTIwc2F5cyUyMCUyMlNhbmElMjInJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGNvbnRyb2xfaW1hZ2UlM0Rjb25kX2ltYWdlJTJDJTBBKS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2Uuc2F2ZSglMjJvdXRwdXQucG5nJTIyKQ==",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> SanaControlNetPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = SanaControlNetPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;ishan24/Sana_600M_1024px_ControlNetPlus_diffusers&quot;</span>,
<span class="hljs-meta">... </span>    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype={<span class="hljs-string">&quot;default&quot;</span>: torch.bfloat16, <span class="hljs-string">&quot;controlnet&quot;</span>: torch.float16, <span class="hljs-string">&quot;transformer&quot;</span>: torch.float16},
<span class="hljs-meta">... </span>    device_map=<span class="hljs-string">&quot;balanced&quot;</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>cond_image = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/ishan24/Sana_600M_1024px_ControlNet_diffusers/resolve/main/hed_example.png&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&#x27;a cat with a neon sign that says &quot;Sana&quot;&#x27;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    control_image=cond_image,
<span class="hljs-meta">... </span>).images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;output.png&quot;</span>)`,wrap:!1}}),{c(){m=i("p"),m.textContent=J,N=a(),u(v.$$.fragment)},l(d){m=r(d,"P",{"data-svelte-h":!0}),g(m)!=="svelte-kvfsh7"&&(m.textContent=J),N=s(d),f(v.$$.fragment,d)},m(d,x){l(d,m,x),l(d,N,x),_(v,d,x),w=!0},p:st,i(d){w||(h(v.$$.fragment,d),w=!0)},o(d){b(v.$$.fragment,d),w=!1},d(d){d&&(t(m),t(N)),y(v,d)}}}function gt(le){let m,J,N,v,w,d,x,He='<img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/>',pe,q,Fe='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.',de,E,Ve="With a ControlNet model, you can provide an additional control image to condition and control Stable Diffusion 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.",ce,Z,Be="The abstract from the paper is:",me,A,We="<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>",ge,D,Qe=`This pipeline was contributed by <a href="https://huggingface.co/ishan24" rel="nofollow">ishan24</a>. ❤️
The original codebase can be found at <a href="https://github.com/NVlabs/Sana" rel="nofollow">NVlabs/Sana</a>, and you can find official ControlNet checkpoints on <a href="https://huggingface.co/Efficient-Large-Model" rel="nofollow">Efficient-Large-Model’s</a> Hub profile.`,ue,G,fe,p,O,Pe,Y,ze='Pipeline for text-to-image generation using <a href="https://huggingface.co/papers/2410.10629" rel="nofollow">Sana</a>.',Me,$,H,Se,K,Re="Function invoked when calling the pipeline for generation.",Ie,M,ke,S,F,Le,ee,Xe=`Disable sliced VAE decoding. If <code>enable_vae_slicing</code> was previously enabled, this method will go back to
computing decoding in one step.`,Ue,I,V,je,te,Ye=`Disable tiled VAE decoding. If <code>enable_vae_tiling</code> was previously enabled, this method will go back to
computing decoding in one step.`,Je,k,B,qe,ne,Ke=`Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.`,Ee,L,W,Ze,oe,et=`Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to
compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow
processing larger images.`,Ae,U,Q,De,ae,tt="Encodes the prompt into text encoder hidden states.",_e,z,he,P,R,Ge,se,nt="Output class for Sana pipelines.",be,X,ye,re,ve;return w=new Oe({props:{title:"ControlNet",local:"controlnet",headingTag:"h1"}}),G=new Oe({props:{title:"SanaControlNetPipeline",local:"diffusers.SanaControlNetPipeline",headingTag:"h2"}}),O=new j({props:{name:"class diffusers.SanaControlNetPipeline",anchor:"diffusers.SanaControlNetPipeline",parameters:[{name:"tokenizer",val:": typing.Union[transformers.models.gemma.tokenization_gemma.GemmaTokenizer, transformers.models.gemma.tokenization_gemma_fast.GemmaTokenizerFast]"},{name:"text_encoder",val:": Gemma2PreTrainedModel"},{name:"vae",val:": AutoencoderDC"},{name:"transformer",val:": SanaTransformer2DModel"},{name:"controlnet",val:": SanaControlNetModel"},{name:"scheduler",val:": DPMSolverMultistepScheduler"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_sana_controlnet.py#L197"}}),H=new j({props:{name:"__call__",anchor:"diffusers.SanaControlNetPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"negative_prompt",val:": str = ''"},{name:"num_inference_steps",val:": int = 20"},{name:"timesteps",val:": typing.List[int] = None"},{name:"sigmas",val:": typing.List[float] = None"},{name:"guidance_scale",val:": float = 4.5"},{name:"control_image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]] = None"},{name:"controlnet_conditioning_scale",val:": typing.Union[float, typing.List[float]] = 1.0"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"height",val:": int = 1024"},{name:"width",val:": int = 1024"},{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.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"clean_caption",val:": bool = False"},{name:"use_resolution_binning",val:": bool = True"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Optional[typing.Callable[[int, int, typing.Dict], NoneType]] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 300"},{name:"complex_human_instruction",val:`: typing.List[str] = ["Given a user prompt, generate an 'Enhanced prompt' that provides detailed visual descriptions suitable for image generation. Evaluate the level of detail in the user prompt:", '- If the prompt is simple, focus on adding specifics about colors, shapes, sizes, textures, and spatial relationships to create vivid and concrete scenes.', '- If the prompt is already detailed, refine and enhance the existing details slightly without overcomplicating.', 'Here are examples of how to transform or refine prompts:', '- User Prompt: A cat sleeping -> Enhanced: A small, fluffy white cat curled up in a round shape, sleeping peacefully on a warm sunny windowsill, surrounded by pots of blooming red flowers.', '- User Prompt: A busy city street -> Enhanced: A bustling city street scene at dusk, featuring glowing street lamps, a diverse crowd of people in colorful clothing, and a double-decker bus passing by towering glass skyscrapers.', 'Please generate only the enhanced description for the prompt below and avoid including any additional commentary or evaluations:', 'User Prompt: ']`}],parametersDescription:[{anchor:"diffusers.SanaControlNetPipeline.__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.SanaControlNetPipeline.__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.SanaControlNetPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 20) &#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.SanaControlNetPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process with schedulers which support a <code>timesteps</code> argument
in their <code>set_timesteps</code> method. If not defined, the default behavior when <code>num_inference_steps</code> is
passed will be used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.SanaControlNetPipeline.__call__.sigmas",description:`<strong>sigmas</strong> (<code>List[float]</code>, <em>optional</em>) &#x2014;
Custom sigmas to use for the denoising process with schedulers which support a <code>sigmas</code> argument in
their <code>set_timesteps</code> method. If not defined, the default behavior when <code>num_inference_steps</code> is passed
will be used.`,name:"sigmas"},{anchor:"diffusers.SanaControlNetPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.5) &#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.SanaControlNetPipeline.__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.SanaControlNetPipeline.__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.SanaControlNetPipeline.__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.SanaControlNetPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.SanaControlNetPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.SanaControlNetPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://huggingface.co/papers/2010.02502" rel="nofollow">https://huggingface.co/papers/2010.02502</a>. Only
applies to <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.SanaControlNetPipeline.__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.SanaControlNetPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</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.SanaControlNetPipeline.__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, <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.SanaControlNetPipeline.__call__.prompt_attention_mask",description:"<strong>prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014; Pre-generated attention mask for text embeddings.",name:"prompt_attention_mask"},{anchor:"diffusers.SanaControlNetPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. For PixArt-Sigma this negative prompt should be &quot;&quot;. If not
provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.SanaControlNetPipeline.__call__.negative_prompt_attention_mask",description:`<strong>negative_prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated attention mask for negative text embeddings.`,name:"negative_prompt_attention_mask"},{anchor:"diffusers.SanaControlNetPipeline.__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.SanaControlNetPipeline.__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.IFPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.SanaControlNetPipeline.__call__.attention_kwargs",description:`<strong>attention_kwargs</strong> &#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.SanaControlNetPipeline.__call__.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the caption before creating embeddings. Requires <code>beautifulsoup4</code> and <code>ftfy</code> to
be installed. If the dependencies are not installed, the embeddings will be created from the raw
prompt.`,name:"clean_caption"},{anchor:"diffusers.SanaControlNetPipeline.__call__.use_resolution_binning",description:`<strong>use_resolution_binning</strong> (<code>bool</code> defaults to <code>True</code>) &#x2014;
If set to <code>True</code>, the requested height and width are first mapped to the closest resolutions using
<code>ASPECT_RATIO_1024_BIN</code>. After the produced latents are decoded into images, they are resized back to
the requested resolution. Useful for generating non-square images.`,name:"use_resolution_binning"},{anchor:"diffusers.SanaControlNetPipeline.__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.SanaControlNetPipeline.__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.SanaControlNetPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code> defaults to <code>300</code>) &#x2014;
Maximum sequence length to use with the <code>prompt</code>.`,name:"max_sequence_length"},{anchor:"diffusers.SanaControlNetPipeline.__call__.complex_human_instruction",description:`<strong>complex_human_instruction</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
Instructions for complex human attention:
<a href="https://github.com/NVlabs/Sana/blob/main/configs/sana_app_config/Sana_1600M_app.yaml#L55" rel="nofollow">https://github.com/NVlabs/Sana/blob/main/configs/sana_app_config/Sana_1600M_app.yaml#L55</a>.`,name:"complex_human_instruction"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_sana_controlnet.py#L776",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/pipelines/controlnet_sana#diffusers.pipelines.sana.pipeline_output.SanaPipelineOutput"
>SanaPipelineOutput</a> is returned,
otherwise a <code>tuple</code> is returned where 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/controlnet_sana#diffusers.pipelines.sana.pipeline_output.SanaPipelineOutput"
>SanaPipelineOutput</a> or <code>tuple</code></p>
`}}),M=new dt({props:{anchor:"diffusers.SanaControlNetPipeline.__call__.example",$$slots:{default:[mt]},$$scope:{ctx:le}}}),F=new j({props:{name:"disable_vae_slicing",anchor:"diffusers.SanaControlNetPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_sana_controlnet.py#L249"}}),V=new j({props:{name:"disable_vae_tiling",anchor:"diffusers.SanaControlNetPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_sana_controlnet.py#L276"}}),B=new j({props:{name:"enable_vae_slicing",anchor:"diffusers.SanaControlNetPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_sana_controlnet.py#L236"}}),W=new j({props:{name:"enable_vae_tiling",anchor:"diffusers.SanaControlNetPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_sana_controlnet.py#L262"}}),Q=new j({props:{name:"encode_prompt",anchor:"diffusers.SanaControlNetPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"negative_prompt",val:": str = ''"},{name:"num_images_per_prompt",val:": int = 1"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"clean_caption",val:": bool = False"},{name:"max_sequence_length",val:": int = 300"},{name:"complex_human_instruction",val:": typing.Optional[typing.List[str]] = None"},{name:"lora_scale",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.SanaControlNetPipeline.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.SanaControlNetPipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt 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>). For
PixArt-Alpha, this should be &quot;&quot;.`,name:"negative_prompt"},{anchor:"diffusers.SanaControlNetPipeline.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.SanaControlNetPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
number of images that should be generated per prompt`,name:"num_images_per_prompt"},{anchor:"diffusers.SanaControlNetPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device to place the resulting embeddings on`,name:"device"},{anchor:"diffusers.SanaControlNetPipeline.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.SanaControlNetPipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. For Sana, it&#x2019;s should be the embeddings of the &quot;&quot; string.`,name:"negative_prompt_embeds"},{anchor:"diffusers.SanaControlNetPipeline.encode_prompt.clean_caption",description:`<strong>clean_caption</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, the function will preprocess and clean the provided caption before encoding.`,name:"clean_caption"},{anchor:"diffusers.SanaControlNetPipeline.encode_prompt.max_sequence_length",description:"<strong>max_sequence_length</strong> (<code>int</code>, defaults to 300) &#x2014; Maximum sequence length to use for the prompt.",name:"max_sequence_length"},{anchor:"diffusers.SanaControlNetPipeline.encode_prompt.complex_human_instruction",description:`<strong>complex_human_instruction</strong> (<code>list[str]</code>, defaults to <code>complex_human_instruction</code>) &#x2014;
If <code>complex_human_instruction</code> is not empty, the function will use the complex Human instruction for
the prompt.`,name:"complex_human_instruction"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_sana_controlnet.py#L349"}}),z=new Oe({props:{title:"SanaPipelineOutput",local:"diffusers.pipelines.sana.pipeline_output.SanaPipelineOutput",headingTag:"h2"}}),R=new j({props:{name:"class diffusers.pipelines.sana.pipeline_output.SanaPipelineOutput",anchor:"diffusers.pipelines.sana.pipeline_output.SanaPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"}],parametersDescription:[{anchor:"diffusers.pipelines.sana.pipeline_output.SanaPipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or numpy array of shape <code>(batch_size, height, width, num_channels)</code>. PIL images or numpy array present the denoised images of the diffusion pipeline.`,name:"images"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/sana/pipeline_output.py#L11"}}),X=new ct({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/controlnet_sana.md"}}),{c(){m=i("meta"),J=a(),N=i("p"),v=a(),u(w.$$.fragment),d=a(),x=i("div"),x.innerHTML=He,pe=a(),q=i("p"),q.innerHTML=Fe,de=a(),E=i("p"),E.textContent=Ve,ce=a(),Z=i("p"),Z.textContent=Be,me=a(),A=i("p"),A.innerHTML=We,ge=a(),D=i("p"),D.innerHTML=Qe,ue=a(),u(G.$$.fragment),fe=a(),p=i("div"),u(O.$$.fragment),Pe=a(),Y=i("p"),Y.innerHTML=ze,Me=a(),$=i("div"),u(H.$$.fragment),Se=a(),K=i("p"),K.textContent=Re,Ie=a(),u(M.$$.fragment),ke=a(),S=i("div"),u(F.$$.fragment),Le=a(),ee=i("p"),ee.innerHTML=Xe,Ue=a(),I=i("div"),u(V.$$.fragment),je=a(),te=i("p"),te.innerHTML=Ye,Je=a(),k=i("div"),u(B.$$.fragment),qe=a(),ne=i("p"),ne.textContent=Ke,Ee=a(),L=i("div"),u(W.$$.fragment),Ze=a(),oe=i("p"),oe.textContent=et,Ae=a(),U=i("div"),u(Q.$$.fragment),De=a(),ae=i("p"),ae.textContent=tt,_e=a(),u(z.$$.fragment),he=a(),P=i("div"),u(R.$$.fragment),Ge=a(),se=i("p"),se.textContent=nt,be=a(),u(X.$$.fragment),ye=a(),re=i("p"),this.h()},l(e){const n=lt("svelte-u9bgzb",document.head);m=r(n,"META",{name:!0,content:!0}),n.forEach(t),J=s(e),N=r(e,"P",{}),T(N).forEach(t),v=s(e),f(w.$$.fragment,e),d=s(e),x=r(e,"DIV",{class:!0,"data-svelte-h":!0}),g(x)!=="svelte-si9ct8"&&(x.innerHTML=He),pe=s(e),q=r(e,"P",{"data-svelte-h":!0}),g(q)!=="svelte-1v2xz23"&&(q.innerHTML=Fe),de=s(e),E=r(e,"P",{"data-svelte-h":!0}),g(E)!=="svelte-1dn0wji"&&(E.textContent=Ve),ce=s(e),Z=r(e,"P",{"data-svelte-h":!0}),g(Z)!=="svelte-1cwsb16"&&(Z.textContent=Be),me=s(e),A=r(e,"P",{"data-svelte-h":!0}),g(A)!=="svelte-fbiw6t"&&(A.innerHTML=We),ge=s(e),D=r(e,"P",{"data-svelte-h":!0}),g(D)!=="svelte-7t3a1f"&&(D.innerHTML=Qe),ue=s(e),f(G.$$.fragment,e),fe=s(e),p=r(e,"DIV",{class:!0});var c=T(p);f(O.$$.fragment,c),Pe=s(c),Y=r(c,"P",{"data-svelte-h":!0}),g(Y)!=="svelte-1ot17tf"&&(Y.innerHTML=ze),Me=s(c),$=r(c,"DIV",{class:!0});var ie=T($);f(H.$$.fragment,ie),Se=s(ie),K=r(ie,"P",{"data-svelte-h":!0}),g(K)!=="svelte-v78lg8"&&(K.textContent=Re),Ie=s(ie),f(M.$$.fragment,ie),ie.forEach(t),ke=s(c),S=r(c,"DIV",{class:!0});var we=T(S);f(F.$$.fragment,we),Le=s(we),ee=r(we,"P",{"data-svelte-h":!0}),g(ee)!=="svelte-1s3c06i"&&(ee.innerHTML=Xe),we.forEach(t),Ue=s(c),I=r(c,"DIV",{class:!0});var xe=T(I);f(V.$$.fragment,xe),je=s(xe),te=r(xe,"P",{"data-svelte-h":!0}),g(te)!=="svelte-pkn4ui"&&(te.innerHTML=Ye),xe.forEach(t),Je=s(c),k=r(c,"DIV",{class:!0});var Ce=T(k);f(B.$$.fragment,Ce),qe=s(Ce),ne=r(Ce,"P",{"data-svelte-h":!0}),g(ne)!=="svelte-14bnrb6"&&(ne.textContent=Ke),Ce.forEach(t),Ee=s(c),L=r(c,"DIV",{class:!0});var Ne=T(L);f(W.$$.fragment,Ne),Ze=s(Ne),oe=r(Ne,"P",{"data-svelte-h":!0}),g(oe)!=="svelte-1xwrf7t"&&(oe.textContent=et),Ne.forEach(t),Ae=s(c),U=r(c,"DIV",{class:!0});var $e=T(U);f(Q.$$.fragment,$e),De=s($e),ae=r($e,"P",{"data-svelte-h":!0}),g(ae)!=="svelte-16q0ax1"&&(ae.textContent=tt),$e.forEach(t),c.forEach(t),_e=s(e),f(z.$$.fragment,e),he=s(e),P=r(e,"DIV",{class:!0});var Te=T(P);f(R.$$.fragment,Te),Ge=s(Te),se=r(Te,"P",{"data-svelte-h":!0}),g(se)!=="svelte-1h3n85u"&&(se.textContent=nt),Te.forEach(t),be=s(e),f(X.$$.fragment,e),ye=s(e),re=r(e,"P",{}),T(re).forEach(t),this.h()},h(){C(m,"name","hf:doc:metadata"),C(m,"content",ut),C(x,"class","flex flex-wrap space-x-1"),C($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),C(P,"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,n){o(document.head,m),l(e,J,n),l(e,N,n),l(e,v,n),_(w,e,n),l(e,d,n),l(e,x,n),l(e,pe,n),l(e,q,n),l(e,de,n),l(e,E,n),l(e,ce,n),l(e,Z,n),l(e,me,n),l(e,A,n),l(e,ge,n),l(e,D,n),l(e,ue,n),_(G,e,n),l(e,fe,n),l(e,p,n),_(O,p,null),o(p,Pe),o(p,Y),o(p,Me),o(p,$),_(H,$,null),o($,Se),o($,K),o($,Ie),_(M,$,null),o(p,ke),o(p,S),_(F,S,null),o(S,Le),o(S,ee),o(p,Ue),o(p,I),_(V,I,null),o(I,je),o(I,te),o(p,Je),o(p,k),_(B,k,null),o(k,qe),o(k,ne),o(p,Ee),o(p,L),_(W,L,null),o(L,Ze),o(L,oe),o(p,Ae),o(p,U),_(Q,U,null),o(U,De),o(U,ae),l(e,_e,n),_(z,e,n),l(e,he,n),l(e,P,n),_(R,P,null),o(P,Ge),o(P,se),l(e,be,n),_(X,e,n),l(e,ye,n),l(e,re,n),ve=!0},p(e,[n]){const c={};n&2&&(c.$$scope={dirty:n,ctx:e}),M.$set(c)},i(e){ve||(h(w.$$.fragment,e),h(G.$$.fragment,e),h(O.$$.fragment,e),h(H.$$.fragment,e),h(M.$$.fragment,e),h(F.$$.fragment,e),h(V.$$.fragment,e),h(B.$$.fragment,e),h(W.$$.fragment,e),h(Q.$$.fragment,e),h(z.$$.fragment,e),h(R.$$.fragment,e),h(X.$$.fragment,e),ve=!0)},o(e){b(w.$$.fragment,e),b(G.$$.fragment,e),b(O.$$.fragment,e),b(H.$$.fragment,e),b(M.$$.fragment,e),b(F.$$.fragment,e),b(V.$$.fragment,e),b(B.$$.fragment,e),b(W.$$.fragment,e),b(Q.$$.fragment,e),b(z.$$.fragment,e),b(R.$$.fragment,e),b(X.$$.fragment,e),ve=!1},d(e){e&&(t(J),t(N),t(v),t(d),t(x),t(pe),t(q),t(de),t(E),t(ce),t(Z),t(me),t(A),t(ge),t(D),t(ue),t(fe),t(p),t(_e),t(he),t(P),t(be),t(ye),t(re)),t(m),y(w,e),y(G,e),y(O),y(H),y(M),y(F),y(V),y(B),y(W),y(Q),y(z,e),y(R),y(X,e)}}}const ut='{"title":"ControlNet","local":"controlnet","sections":[{"title":"SanaControlNetPipeline","local":"diffusers.SanaControlNetPipeline","sections":[],"depth":2},{"title":"SanaPipelineOutput","local":"diffusers.pipelines.sana.pipeline_output.SanaPipelineOutput","sections":[],"depth":2}],"depth":1}';function ft(le){return at(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xt extends it{constructor(m){super(),rt(this,m,ft,gt,ot,{})}}export{xt as component};
