import{s as Ze,o as We,n as Fe}from"../chunks/scheduler.182ea377.js";import{S as Re,i as Ye,g as r,s as o,r as _,A as Ke,h as l,f as t,c as s,j as M,u as b,x as u,k as L,y as i,a as p,v,d as S,t as x,w}from"../chunks/index.abf12888.js";import{T as Qe}from"../chunks/Tip.230e2334.js";import{D as ne}from"../chunks/Docstring.93f6f462.js";import{C as Xe}from"../chunks/CodeBlock.57fe6e13.js";import{E as et}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as Ie}from"../chunks/Heading.16916d63.js";function tt(F){let a,D='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(){a=r("p"),a.innerHTML=D},l(m){a=l(m,"P",{"data-svelte-h":!0}),u(a)!=="svelte-1wmc0l4"&&(a.innerHTML=D)},m(m,g){p(m,a,g)},p:Fe,d(m){m&&t(a)}}}function nt(F){let a,D="Examples:",m,g,h;return g=new Xe({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uU0FHUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uU0FHUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyYSUyMHBob3RvJTIwb2YlMjBhbiUyMGFzdHJvbmF1dCUyMHJpZGluZyUyMGElMjBob3JzZSUyMG9uJTIwbWFycyUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBzYWdfc2NhbGUlM0QwLjc1KS5pbWFnZXMlNUIwJTVE",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> StableDiffusionSAGPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionSAGPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt, sag_scale=<span class="hljs-number">0.75</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){a=r("p"),a.textContent=D,m=o(),_(g.$$.fragment)},l(f){a=l(f,"P",{"data-svelte-h":!0}),u(a)!=="svelte-kvfsh7"&&(a.textContent=D),m=s(f),b(g.$$.fragment,f)},m(f,P){p(f,a,P),p(f,m,P),v(g,f,P),h=!0},p:Fe,i(f){h||(S(g.$$.fragment,f),h=!0)},o(f){x(g.$$.fragment,f),h=!1},d(f){f&&(t(a),t(m)),w(g,f)}}}function it(F){let a,D,m,g,h,f,P,Me='<a href="https://huggingface.co/papers/2210.00939" rel="nofollow">Improving Sample Quality of Diffusion Models Using Self-Attention Guidance</a> is by Susung Hong et al.',oe,U,Le="The abstract from the paper is:",se,J,Ue="<em>Denoising diffusion models (DDMs) have attracted attention for their exceptional generation quality and diversity. This success is largely attributed to the use of class- or text-conditional diffusion guidance methods, such as classifier and classifier-free guidance. In this paper, we present a more comprehensive perspective that goes beyond the traditional guidance methods. From this generalized perspective, we introduce novel condition- and training-free strategies to enhance the quality of generated images. As a simple solution, blur guidance improves the suitability of intermediate samples for their fine-scale information and structures, enabling diffusion models to generate higher quality samples with a moderate guidance scale. Improving upon this, Self-Attention Guidance (SAG) uses the intermediate self-attention maps of diffusion models to enhance their stability and efficacy. Specifically, SAG adversarially blurs only the regions that diffusion models attend to at each iteration and guides them accordingly. Our experimental results show that our SAG improves the performance of various diffusion models, including ADM, IDDPM, Stable Diffusion, and DiT. Moreover, combining SAG with conventional guidance methods leads to further improvement.</em>",ae,O,Je='You can find additional information about Self-Attention Guidance on the <a href="https://ku-cvlab.github.io/Self-Attention-Guidance" rel="nofollow">project page</a>, <a href="https://github.com/KU-CVLAB/Self-Attention-Guidance" rel="nofollow">original codebase</a>, and try it out in a <a href="https://huggingface.co/spaces/susunghong/Self-Attention-Guidance" rel="nofollow">demo</a> or <a href="https://colab.research.google.com/github/SusungHong/Self-Attention-Guidance/blob/main/SAG_Stable.ipynb" rel="nofollow">notebook</a>.',re,G,le,N,de,d,E,be,Z,Oe="Pipeline for text-to-image generation using Stable Diffusion.",ve,W,Ne=`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
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Se,R,Ee="The pipeline also inherits the following loading methods:",xe,Y,je='<li><a href="/docs/diffusers/main/en/api/loaders/textual_inversion#diffusers.loaders.TextualInversionLoaderMixin.load_textual_inversion">load_textual_inversion()</a> for loading textual inversion embeddings</li> <li><a href="/docs/diffusers/main/en/api/loaders/ip_adapter#diffusers.loaders.IPAdapterMixin.load_ip_adapter">load_ip_adapter()</a> for loading IP Adapters</li>',we,$,j,Pe,K,He="The call function to the pipeline for generation.",De,T,$e,k,H,ye,Q,ze=`Disable sliced VAE decoding. If <code>enable_vae_slicing</code> was previously enabled, this method will go back to
computing decoding in one step.`,Ae,C,z,Ge,X,qe=`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.`,Te,I,q,ke,ee,Be="Encodes the prompt into text encoder hidden states.",pe,B,ce,y,V,Ce,te,Ve="Output class for Stable Diffusion pipelines.",fe,ie,me;return h=new Ie({props:{title:"Self-Attention Guidance",local:"self-attention-guidance",headingTag:"h1"}}),G=new Qe({props:{$$slots:{default:[tt]},$$scope:{ctx:F}}}),N=new Ie({props:{title:"StableDiffusionSAGPipeline",local:"diffusers.StableDiffusionSAGPipeline",headingTag:"h2"}}),E=new ne({props:{name:"class diffusers.StableDiffusionSAGPipeline",anchor:"diffusers.StableDiffusionSAGPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"image_encoder",val:": Optional = None"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionSAGPipeline.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 images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionSAGPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIPTextModel</a>) &#x2014;
Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionSAGPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionSAGPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.StableDiffusionSAGPipeline.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>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/main/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionSAGPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>StableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for more details
about a model&#x2019;s potential harms.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionSAGPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) &#x2014;
A <code>CLIPImageProcessor</code> to extract features from generated images; used as inputs to the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py#L101"}}),j=new ne({props:{name:"__call__",anchor:"diffusers.StableDiffusionSAGPipeline.__call__",parameters:[{name:"prompt",val:": Union = None"},{name:"height",val:": Optional = None"},{name:"width",val:": Optional = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"sag_scale",val:": float = 0.75"},{name:"negative_prompt",val:": Union = None"},{name:"num_images_per_prompt",val:": Optional = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": Union = None"},{name:"latents",val:": Optional = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"ip_adapter_image",val:": Union = None"},{name:"output_type",val:": Optional = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": Optional = None"},{name:"callback_steps",val:": Optional = 1"},{name:"cross_attention_kwargs",val:": Optional = None"},{name:"clip_skip",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionSAGPipeline.__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.StableDiffusionSAGPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.StableDiffusionSAGPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.StableDiffusionSAGPipeline.__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.StableDiffusionSAGPipeline.__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.StableDiffusionSAGPipeline.__call__.sag_scale",description:`<strong>sag_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 0.75) &#x2014;
Chosen between [0, 1.0] for better quality.`,name:"sag_scale"},{anchor:"diffusers.StableDiffusionSAGPipeline.__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.StableDiffusionSAGPipeline.__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.StableDiffusionSAGPipeline.__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/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.StableDiffusionSAGPipeline.__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.StableDiffusionSAGPipeline.__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 is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionSAGPipeline.__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 (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusionSAGPipeline.__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 (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are generated from the <code>negative_prompt</code> input argument.
ip_adapter_image &#x2014; (<code>PipelineImageInput</code>, <em>optional</em>):
Optional image input to work with IP Adapters.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusionSAGPipeline.__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.StableDiffusionSAGPipeline.__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/main/en/api/pipelines/stable_diffusion/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionSAGPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls every <code>callback_steps</code> steps during inference. The function is called with the
following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionSAGPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function is called. If not specified, the callback is called at
every step.`,name:"callback_steps"},{anchor:"diffusers.StableDiffusionSAGPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow"><code>self.processor</code></a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.StableDiffusionSAGPipeline.__call__.clip_skip",description:`<strong>clip_skip</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
the output of the pre-final layer will be used for computing the prompt embeddings.`,name:"clip_skip"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py#L536",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/stable_diffusion/upscale#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/main/en/api/pipelines/stable_diffusion/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),T=new et({props:{anchor:"diffusers.StableDiffusionSAGPipeline.__call__.example",$$slots:{default:[nt]},$$scope:{ctx:F}}}),H=new ne({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionSAGPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py#L173"}}),z=new ne({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionSAGPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py#L165"}}),q=new ne({props:{name:"encode_prompt",anchor:"diffusers.StableDiffusionSAGPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:""},{name:"num_images_per_prompt",val:""},{name:"do_classifier_free_guidance",val:""},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"lora_scale",val:": Optional = None"},{name:"clip_skip",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionSAGPipeline.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.StableDiffusionSAGPipeline.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.StableDiffusionSAGPipeline.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.StableDiffusionSAGPipeline.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.StableDiffusionSAGPipeline.encode_prompt.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.StableDiffusionSAGPipeline.encode_prompt.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.StableDiffusionSAGPipeline.encode_prompt.lora_scale",description:`<strong>lora_scale</strong> (<code>float</code>, <em>optional</em>) &#x2014;
A LoRA scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`,name:"lora_scale"},{anchor:"diffusers.StableDiffusionSAGPipeline.encode_prompt.clip_skip",description:`<strong>clip_skip</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
the output of the pre-final layer will be used for computing the prompt embeddings.`,name:"clip_skip"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_sag/pipeline_stable_diffusion_sag.py#L214"}}),B=new Ie({props:{title:"StableDiffusionOutput",local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",headingTag:"h2"}}),V=new ne({props:{name:"class diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",parameters:[{name:"images",val:": Union"},{name:"nsfw_content_detected",val:": Optional"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.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>.`,name:"images"},{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content or
<code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_output.py#L10"}}),{c(){a=r("meta"),D=o(),m=r("p"),g=o(),_(h.$$.fragment),f=o(),P=r("p"),P.innerHTML=Me,oe=o(),U=r("p"),U.textContent=Le,se=o(),J=r("p"),J.innerHTML=Ue,ae=o(),O=r("p"),O.innerHTML=Je,re=o(),_(G.$$.fragment),le=o(),_(N.$$.fragment),de=o(),d=r("div"),_(E.$$.fragment),be=o(),Z=r("p"),Z.textContent=Oe,ve=o(),W=r("p"),W.innerHTML=Ne,Se=o(),R=r("p"),R.textContent=Ee,xe=o(),Y=r("ul"),Y.innerHTML=je,we=o(),$=r("div"),_(j.$$.fragment),Pe=o(),K=r("p"),K.textContent=He,De=o(),_(T.$$.fragment),$e=o(),k=r("div"),_(H.$$.fragment),ye=o(),Q=r("p"),Q.innerHTML=ze,Ae=o(),C=r("div"),_(z.$$.fragment),Ge=o(),X=r("p"),X.textContent=qe,Te=o(),I=r("div"),_(q.$$.fragment),ke=o(),ee=r("p"),ee.textContent=Be,pe=o(),_(B.$$.fragment),ce=o(),y=r("div"),_(V.$$.fragment),Ce=o(),te=r("p"),te.textContent=Ve,fe=o(),ie=r("p"),this.h()},l(e){const n=Ke("svelte-u9bgzb",document.head);a=l(n,"META",{name:!0,content:!0}),n.forEach(t),D=s(e),m=l(e,"P",{}),M(m).forEach(t),g=s(e),b(h.$$.fragment,e),f=s(e),P=l(e,"P",{"data-svelte-h":!0}),u(P)!=="svelte-uuuzms"&&(P.innerHTML=Me),oe=s(e),U=l(e,"P",{"data-svelte-h":!0}),u(U)!=="svelte-1cwsb16"&&(U.textContent=Le),se=s(e),J=l(e,"P",{"data-svelte-h":!0}),u(J)!=="svelte-1wv0j5a"&&(J.innerHTML=Ue),ae=s(e),O=l(e,"P",{"data-svelte-h":!0}),u(O)!=="svelte-rke90q"&&(O.innerHTML=Je),re=s(e),b(G.$$.fragment,e),le=s(e),b(N.$$.fragment,e),de=s(e),d=l(e,"DIV",{class:!0});var c=M(d);b(E.$$.fragment,c),be=s(c),Z=l(c,"P",{"data-svelte-h":!0}),u(Z)!=="svelte-35p306"&&(Z.textContent=Oe),ve=s(c),W=l(c,"P",{"data-svelte-h":!0}),u(W)!=="svelte-496sm0"&&(W.innerHTML=Ne),Se=s(c),R=l(c,"P",{"data-svelte-h":!0}),u(R)!=="svelte-14s6m4u"&&(R.textContent=Ee),xe=s(c),Y=l(c,"UL",{"data-svelte-h":!0}),u(Y)!=="svelte-b8xvs2"&&(Y.innerHTML=je),we=s(c),$=l(c,"DIV",{class:!0});var A=M($);b(j.$$.fragment,A),Pe=s(A),K=l(A,"P",{"data-svelte-h":!0}),u(K)!=="svelte-50j04k"&&(K.textContent=He),De=s(A),b(T.$$.fragment,A),A.forEach(t),$e=s(c),k=l(c,"DIV",{class:!0});var ue=M(k);b(H.$$.fragment,ue),ye=s(ue),Q=l(ue,"P",{"data-svelte-h":!0}),u(Q)!=="svelte-1s3c06i"&&(Q.innerHTML=ze),ue.forEach(t),Ae=s(c),C=l(c,"DIV",{class:!0});var ge=M(C);b(z.$$.fragment,ge),Ge=s(ge),X=l(ge,"P",{"data-svelte-h":!0}),u(X)!=="svelte-14bnrb6"&&(X.textContent=qe),ge.forEach(t),Te=s(c),I=l(c,"DIV",{class:!0});var he=M(I);b(q.$$.fragment,he),ke=s(he),ee=l(he,"P",{"data-svelte-h":!0}),u(ee)!=="svelte-16q0ax1"&&(ee.textContent=Be),he.forEach(t),c.forEach(t),pe=s(e),b(B.$$.fragment,e),ce=s(e),y=l(e,"DIV",{class:!0});var _e=M(y);b(V.$$.fragment,_e),Ce=s(_e),te=l(_e,"P",{"data-svelte-h":!0}),u(te)!=="svelte-1qpjiuf"&&(te.textContent=Ve),_e.forEach(t),fe=s(e),ie=l(e,"P",{}),M(ie).forEach(t),this.h()},h(){L(a,"name","hf:doc:metadata"),L(a,"content",ot),L($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),L(y,"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){i(document.head,a),p(e,D,n),p(e,m,n),p(e,g,n),v(h,e,n),p(e,f,n),p(e,P,n),p(e,oe,n),p(e,U,n),p(e,se,n),p(e,J,n),p(e,ae,n),p(e,O,n),p(e,re,n),v(G,e,n),p(e,le,n),v(N,e,n),p(e,de,n),p(e,d,n),v(E,d,null),i(d,be),i(d,Z),i(d,ve),i(d,W),i(d,Se),i(d,R),i(d,xe),i(d,Y),i(d,we),i(d,$),v(j,$,null),i($,Pe),i($,K),i($,De),v(T,$,null),i(d,$e),i(d,k),v(H,k,null),i(k,ye),i(k,Q),i(d,Ae),i(d,C),v(z,C,null),i(C,Ge),i(C,X),i(d,Te),i(d,I),v(q,I,null),i(I,ke),i(I,ee),p(e,pe,n),v(B,e,n),p(e,ce,n),p(e,y,n),v(V,y,null),i(y,Ce),i(y,te),p(e,fe,n),p(e,ie,n),me=!0},p(e,[n]){const c={};n&2&&(c.$$scope={dirty:n,ctx:e}),G.$set(c);const A={};n&2&&(A.$$scope={dirty:n,ctx:e}),T.$set(A)},i(e){me||(S(h.$$.fragment,e),S(G.$$.fragment,e),S(N.$$.fragment,e),S(E.$$.fragment,e),S(j.$$.fragment,e),S(T.$$.fragment,e),S(H.$$.fragment,e),S(z.$$.fragment,e),S(q.$$.fragment,e),S(B.$$.fragment,e),S(V.$$.fragment,e),me=!0)},o(e){x(h.$$.fragment,e),x(G.$$.fragment,e),x(N.$$.fragment,e),x(E.$$.fragment,e),x(j.$$.fragment,e),x(T.$$.fragment,e),x(H.$$.fragment,e),x(z.$$.fragment,e),x(q.$$.fragment,e),x(B.$$.fragment,e),x(V.$$.fragment,e),me=!1},d(e){e&&(t(D),t(m),t(g),t(f),t(P),t(oe),t(U),t(se),t(J),t(ae),t(O),t(re),t(le),t(de),t(d),t(pe),t(ce),t(y),t(fe),t(ie)),t(a),w(h,e),w(G,e),w(N,e),w(E),w(j),w(T),w(H),w(z),w(q),w(B,e),w(V)}}}const ot='{"title":"Self-Attention Guidance","local":"self-attention-guidance","sections":[{"title":"StableDiffusionSAGPipeline","local":"diffusers.StableDiffusionSAGPipeline","sections":[],"depth":2},{"title":"StableDiffusionOutput","local":"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput","sections":[],"depth":2}],"depth":1}';function st(F){return We(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class mt extends Re{constructor(a){super(),Ye(this,a,st,it,Ze,{})}}export{mt as component};
