import{s as je,o as Pe,n as De}from"../chunks/scheduler.182ea377.js";import{S as ke,i as Ze,g as p,s as o,r as M,A as Be,h as d,f as t,c as i,j as H,u as w,x as h,k as z,y as l,a,v as T,d as C,t as U,w as v}from"../chunks/index.abf12888.js";import{T as We}from"../chunks/Tip.230e2334.js";import{D as le}from"../chunks/Docstring.93f6f462.js";import{C as Ne}from"../chunks/CodeBlock.57fe6e13.js";import{E as $e}from"../chunks/ExampleCodeBlock.658f5cd6.js";import{H as _e}from"../chunks/Heading.16916d63.js";function Se(G){let s,_='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(){s=p("p"),s.innerHTML=_},l(m){s=d(m,"P",{"data-svelte-h":!0}),h(s)!=="svelte-1wmc0l4"&&(s.innerHTML=_)},m(m,u){a(m,s,u)},p:De,d(m){m&&t(s)}}}function Ge(G){let s,_="Example:",m,u,g;return u=new Ne({props:{code:"aW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQ3ljbGVEaWZmdXNpb25QaXBlbGluZSUyQyUyMERESU1TY2hlZHVsZXIlMEElMEElMjMlMjBsb2FkJTIwdGhlJTIwcGlwZWxpbmUlMEElMjMlMjBtYWtlJTIwc3VyZSUyMHlvdSdyZSUyMGxvZ2dlZCUyMGluJTIwd2l0aCUyMCU2MGh1Z2dpbmdmYWNlLWNsaSUyMGxvZ2luJTYwJTBBbW9kZWxfaWRfb3JfcGF0aCUyMCUzRCUyMCUyMkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTQlMjIlMEFz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VybCklMEFpbml0X2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFpbml0X2ltYWdlJTIwJTNEJTIwaW5pdF9pbWFnZS5yZXNpemUoKDUxMiUyQyUyMDUxMikpJTBBaW5pdF9pbWFnZS5zYXZlKCUyMmJsYWNrLnBuZyUyMiklMEElMEFzb3VyY2VfcHJvbXB0JTIwJTNEJTIwJTIyQSUyMGJsYWNrJTIwY29sb3JlZCUyMGNhciUyMiUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBibHVlJTIwY29sb3JlZCUyMGNhciUyMiUwQSUwQSUyMyUyMGNhbGwlMjB0aGUlMjBwaXBlbGluZSUwQXRvcmNoLm1hbnVhbF9zZWVkKDApJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMHNvdXJjZV9wcm9tcHQlM0Rzb3VyY2VfcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMGV0YSUzRDAuMSUyQyUwQSUyMCUyMCUyMCUyMHN0cmVuZ3RoJTNEMC44NSUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEMyUyQyUwQSUyMCUyMCUyMCUyMHNvdXJjZV9ndWlkYW5jZV9zY2FsZSUzRDElMkMlMEEpLmltYWdlcyU1QjAlNUQlMEElMEFpbWFnZS5zYXZlKCUyMmJsYWNrX3RvX2JsdWUucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> CycleDiffusionPipeline, DDIMScheduler

<span class="hljs-comment"># load the pipeline</span>
<span class="hljs-comment"># make sure you&#x27;re logged in with \`huggingface-cli login\`</span>
model_id_or_path = <span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>
scheduler = DDIMScheduler.from_pretrained(model_id_or_path, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
pipe = CycleDiffusionPipeline.from_pretrained(model_id_or_path, scheduler=scheduler).to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># let&#x27;s download an initial image</span>
url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/ChenWu98/cycle-diffusion/main/data/dalle2/An%20astronaut%20riding%20a%20horse.png&quot;</span>
response = requests.get(url)
init_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
init_image = init_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))
init_image.save(<span class="hljs-string">&quot;horse.png&quot;</span>)

<span class="hljs-comment"># let&#x27;s specify a prompt</span>
source_prompt = <span class="hljs-string">&quot;An astronaut riding a horse&quot;</span>
prompt = <span class="hljs-string">&quot;An astronaut riding an elephant&quot;</span>

<span class="hljs-comment"># call the pipeline</span>
image = pipe(
    prompt=prompt,
    source_prompt=source_prompt,
    image=init_image,
    num_inference_steps=<span class="hljs-number">100</span>,
    eta=<span class="hljs-number">0.1</span>,
    strength=<span class="hljs-number">0.8</span>,
    guidance_scale=<span class="hljs-number">2</span>,
    source_guidance_scale=<span class="hljs-number">1</span>,
).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;horse_to_elephant.png&quot;</span>)

<span class="hljs-comment"># let&#x27;s try another example</span>
<span class="hljs-comment"># See more samples at the original repo: https://github.com/ChenWu98/cycle-diffusion</span>
url = (
    <span class="hljs-string">&quot;https://raw.githubusercontent.com/ChenWu98/cycle-diffusion/main/data/dalle2/A%20black%20colored%20car.png&quot;</span>
)
response = requests.get(url)
init_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
init_image = init_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))
init_image.save(<span class="hljs-string">&quot;black.png&quot;</span>)

source_prompt = <span class="hljs-string">&quot;A black colored car&quot;</span>
prompt = <span class="hljs-string">&quot;A blue colored car&quot;</span>

<span class="hljs-comment"># call the pipeline</span>
torch.manual_seed(<span class="hljs-number">0</span>)
image = pipe(
    prompt=prompt,
    source_prompt=source_prompt,
    image=init_image,
    num_inference_steps=<span class="hljs-number">100</span>,
    eta=<span class="hljs-number">0.1</span>,
    strength=<span class="hljs-number">0.85</span>,
    guidance_scale=<span class="hljs-number">3</span>,
    source_guidance_scale=<span class="hljs-number">1</span>,
).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;black_to_blue.png&quot;</span>)`,wrap:!1}}),{c(){s=p("p"),s.textContent=_,m=o(),M(u.$$.fragment)},l(r){s=d(r,"P",{"data-svelte-h":!0}),h(s)!=="svelte-11lpom8"&&(s.textContent=_),m=i(r),w(u.$$.fragment,r)},m(r,y){a(r,s,y),a(r,m,y),T(u,r,y),g=!0},p:De,i(r){g||(C(u.$$.fragment,r),g=!0)},o(r){U(u.$$.fragment,r),g=!1},d(r){r&&(t(s),t(m)),v(u,r)}}}function Le(G){let s,_,m,u,g,r,y,be='Cycle Diffusion is a text guided image-to-image generation model proposed in <a href="https://huggingface.co/papers/2210.05559" rel="nofollow">Unifying Diffusion Models’ Latent Space, with Applications to CycleDiffusion and Guidance</a> by Chen Henry Wu, Fernando De la Torre.',A,P,Me="The abstract from the paper is:",q,k,we='<em>Diffusion models have achieved unprecedented performance in generative modeling. The commonly-adopted formulation of the latent code of diffusion models is a sequence of gradually denoised samples, as opposed to the simpler (e.g., Gaussian) latent space of GANs, VAEs, and normalizing flows. This paper provides an alternative, Gaussian formulation of the latent space of various diffusion models, as well as an invertible DPM-Encoder that maps images into the latent space. While our formulation is purely based on the definition of diffusion models, we demonstrate several intriguing consequences. (1) Empirically, we observe that a common latent space emerges from two diffusion models trained independently on related domains. In light of this finding, we propose CycleDiffusion, which uses DPM-Encoder for unpaired image-to-image translation. Furthermore, applying CycleDiffusion to text-to-image diffusion models, we show that large-scale text-to-image diffusion models can be used as zero-shot image-to-image editors. (2) One can guide pre-trained diffusion models and GANs by controlling the latent codes in a unified, plug-and-play formulation based on energy-based models. Using the CLIP model and a face recognition model as guidance, we demonstrate that diffusion models have better coverage of low-density sub-populations and individuals than GANs. The code is publicly available at <a href="https://github.com/ChenWu98/cycle-diffusion" rel="nofollow">this https URL</a>.</em>',O,x,K,Z,ee,c,B,re,L,Te="Pipeline for text-guided image to image generation using Stable Diffusion.",ce,E,Ce=`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.).`,pe,V,Ue="The pipeline also inherits the following loading methods:",de,Q,ve='<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/lora#diffusers.loaders.LoraLoaderMixin.load_lora_weights">load_lora_weights()</a> for loading LoRA weights</li> <li><a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.LoraLoaderMixin.save_lora_weights">save_lora_weights()</a> for saving LoRA weights</li>',fe,b,W,me,X,Je="The call function to the pipeline for generation.",ue,D,ge,j,N,he,R,Ie="Encodes the prompt into text encoder hidden states.",ne,$,te,J,S,ye,Y,xe="Output class for Stable Diffusion pipelines.",se,F,oe;return g=new _e({props:{title:"Cycle Diffusion",local:"cycle-diffusion",headingTag:"h1"}}),x=new We({props:{$$slots:{default:[Se]},$$scope:{ctx:G}}}),Z=new _e({props:{title:"CycleDiffusionPipeline",local:"diffusers.CycleDiffusionPipeline",headingTag:"h2"}}),B=new le({props:{name:"class diffusers.CycleDiffusionPipeline",anchor:"diffusers.CycleDiffusionPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDIMScheduler"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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 only be an
instance of <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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/pipeline_cycle_diffusion.py#L139"}}),W=new le({props:{name:"__call__",anchor:"diffusers.CycleDiffusionPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"source_prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.FloatTensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.FloatTensor]] = None"},{name:"strength",val:": float = 0.8"},{name:"num_inference_steps",val:": typing.Optional[int] = 50"},{name:"guidance_scale",val:": typing.Optional[float] = 7.5"},{name:"source_guidance_scale",val:": typing.Optional[float] = 1"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": typing.Optional[float] = 0.1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"clip_skip",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.CycleDiffusionPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.CycleDiffusionPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> <code>np.ndarray</code>, <code>PIL.Image.Image</code>, <code>List[torch.FloatTensor]</code>, <code>List[PIL.Image.Image]</code>, or <code>List[np.ndarray]</code>) &#x2014;
<code>Image</code> or tensor representing an image batch to be used as the starting point. Can also accept image
latents as <code>image</code>, but if passing latents directly it is not encoded again.`,name:"image"},{anchor:"diffusers.CycleDiffusionPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Indicates extent to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code> is used as a
starting point and more noise is added the higher the <code>strength</code>. The number of denoising steps depends
on the amount of noise initially added. When <code>strength</code> is 1, added noise is maximum and the denoising
process runs for the full number of iterations specified in <code>num_inference_steps</code>. A value of 1
essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__call__.source_guidance_scale",description:`<strong>source_guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
Guidance scale for the source prompt. This is useful to control the amount of influence the source
prompt has for encoding.`,name:"source_guidance_scale"},{anchor:"diffusers.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.`,name:"negative_prompt_embeds"},{anchor:"diffusers.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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.CycleDiffusionPipeline.__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/pipeline_cycle_diffusion.py#L627",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>
`}}),D=new $e({props:{anchor:"diffusers.CycleDiffusionPipeline.__call__.example",$$slots:{default:[Ge]},$$scope:{ctx:G}}}),N=new le({props:{name:"encode_prompt",anchor:"diffusers.CycleDiffusionPipeline.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:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"lora_scale",val:": typing.Optional[float] = None"},{name:"clip_skip",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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.CycleDiffusionPipeline.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/pipeline_cycle_diffusion.py#L284"}}),$=new _e({props:{title:"StableDiffusionPiplineOutput",local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",headingTag:"h2"}}),S=new le({props:{name:"class diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"nsfw_content_detected",val:": typing.Optional[typing.List[bool]]"}],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#L11"}}),{c(){s=p("meta"),_=o(),m=p("p"),u=o(),M(g.$$.fragment),r=o(),y=p("p"),y.innerHTML=be,A=o(),P=p("p"),P.textContent=Me,q=o(),k=p("p"),k.innerHTML=we,O=o(),M(x.$$.fragment),K=o(),M(Z.$$.fragment),ee=o(),c=p("div"),M(B.$$.fragment),re=o(),L=p("p"),L.textContent=Te,ce=o(),E=p("p"),E.innerHTML=Ce,pe=o(),V=p("p"),V.textContent=Ue,de=o(),Q=p("ul"),Q.innerHTML=ve,fe=o(),b=p("div"),M(W.$$.fragment),me=o(),X=p("p"),X.textContent=Je,ue=o(),M(D.$$.fragment),ge=o(),j=p("div"),M(N.$$.fragment),he=o(),R=p("p"),R.textContent=Ie,ne=o(),M($.$$.fragment),te=o(),J=p("div"),M(S.$$.fragment),ye=o(),Y=p("p"),Y.textContent=xe,se=o(),F=p("p"),this.h()},l(e){const n=Be("svelte-u9bgzb",document.head);s=d(n,"META",{name:!0,content:!0}),n.forEach(t),_=i(e),m=d(e,"P",{}),H(m).forEach(t),u=i(e),w(g.$$.fragment,e),r=i(e),y=d(e,"P",{"data-svelte-h":!0}),h(y)!=="svelte-1fwg3ox"&&(y.innerHTML=be),A=i(e),P=d(e,"P",{"data-svelte-h":!0}),h(P)!=="svelte-1cwsb16"&&(P.textContent=Me),q=i(e),k=d(e,"P",{"data-svelte-h":!0}),h(k)!=="svelte-1mg5eg8"&&(k.innerHTML=we),O=i(e),w(x.$$.fragment,e),K=i(e),w(Z.$$.fragment,e),ee=i(e),c=d(e,"DIV",{class:!0});var f=H(c);w(B.$$.fragment,f),re=i(f),L=d(f,"P",{"data-svelte-h":!0}),h(L)!=="svelte-qx88ry"&&(L.textContent=Te),ce=i(f),E=d(f,"P",{"data-svelte-h":!0}),h(E)!=="svelte-496sm0"&&(E.innerHTML=Ce),pe=i(f),V=d(f,"P",{"data-svelte-h":!0}),h(V)!=="svelte-14s6m4u"&&(V.textContent=Ue),de=i(f),Q=d(f,"UL",{"data-svelte-h":!0}),h(Q)!=="svelte-ks5x56"&&(Q.innerHTML=ve),fe=i(f),b=d(f,"DIV",{class:!0});var I=H(b);w(W.$$.fragment,I),me=i(I),X=d(I,"P",{"data-svelte-h":!0}),h(X)!=="svelte-50j04k"&&(X.textContent=Je),ue=i(I),w(D.$$.fragment,I),I.forEach(t),ge=i(f),j=d(f,"DIV",{class:!0});var ie=H(j);w(N.$$.fragment,ie),he=i(ie),R=d(ie,"P",{"data-svelte-h":!0}),h(R)!=="svelte-16q0ax1"&&(R.textContent=Ie),ie.forEach(t),f.forEach(t),ne=i(e),w($.$$.fragment,e),te=i(e),J=d(e,"DIV",{class:!0});var ae=H(J);w(S.$$.fragment,ae),ye=i(ae),Y=d(ae,"P",{"data-svelte-h":!0}),h(Y)!=="svelte-1qpjiuf"&&(Y.textContent=xe),ae.forEach(t),se=i(e),F=d(e,"P",{}),H(F).forEach(t),this.h()},h(){z(s,"name","hf:doc:metadata"),z(s,"content",Ee),z(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){l(document.head,s),a(e,_,n),a(e,m,n),a(e,u,n),T(g,e,n),a(e,r,n),a(e,y,n),a(e,A,n),a(e,P,n),a(e,q,n),a(e,k,n),a(e,O,n),T(x,e,n),a(e,K,n),T(Z,e,n),a(e,ee,n),a(e,c,n),T(B,c,null),l(c,re),l(c,L),l(c,ce),l(c,E),l(c,pe),l(c,V),l(c,de),l(c,Q),l(c,fe),l(c,b),T(W,b,null),l(b,me),l(b,X),l(b,ue),T(D,b,null),l(c,ge),l(c,j),T(N,j,null),l(j,he),l(j,R),a(e,ne,n),T($,e,n),a(e,te,n),a(e,J,n),T(S,J,null),l(J,ye),l(J,Y),a(e,se,n),a(e,F,n),oe=!0},p(e,[n]){const f={};n&2&&(f.$$scope={dirty:n,ctx:e}),x.$set(f);const I={};n&2&&(I.$$scope={dirty:n,ctx:e}),D.$set(I)},i(e){oe||(C(g.$$.fragment,e),C(x.$$.fragment,e),C(Z.$$.fragment,e),C(B.$$.fragment,e),C(W.$$.fragment,e),C(D.$$.fragment,e),C(N.$$.fragment,e),C($.$$.fragment,e),C(S.$$.fragment,e),oe=!0)},o(e){U(g.$$.fragment,e),U(x.$$.fragment,e),U(Z.$$.fragment,e),U(B.$$.fragment,e),U(W.$$.fragment,e),U(D.$$.fragment,e),U(N.$$.fragment,e),U($.$$.fragment,e),U(S.$$.fragment,e),oe=!1},d(e){e&&(t(_),t(m),t(u),t(r),t(y),t(A),t(P),t(q),t(k),t(O),t(K),t(ee),t(c),t(ne),t(te),t(J),t(se),t(F)),t(s),v(g,e),v(x,e),v(Z,e),v(B),v(W),v(D),v(N),v($,e),v(S)}}}const Ee='{"title":"Cycle Diffusion","local":"cycle-diffusion","sections":[{"title":"CycleDiffusionPipeline","local":"diffusers.CycleDiffusionPipeline","sections":[],"depth":2},{"title":"StableDiffusionPiplineOutput","local":"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput","sections":[],"depth":2}],"depth":1}';function Ve(G){return Pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ae extends ke{constructor(s){super(),Ze(this,s,Ve,Le,je,{})}}export{Ae as component};
