import{S as uo,i as ho,s as mo,e as o,k as d,w as v,t as s,M as go,c as r,d as n,m as c,a as i,x as P,h as l,b as a,G as e,g as f,y as I,L as _o,q as b,o as C,B as y,v as vo}from"../../../chunks/vendor-hf-doc-builder.js";import{D as Pe}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as mt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Po(wn){let x,je,L,D,Ie,F,gt,be,_t,We,w,M,Ce,q,vt,ye,Pt,He,j,W,It,bt,Je,le,Ct,Re,de,yt,Be,m,xt,H,Lt,wt,J,Ut,Tt,Ye,U,N,xe,R,$t,Le,kt,Ke,S,we,T,Ue,Et,Dt,Te,Mt,Nt,ce,St,Vt,B,$,$e,Y,At,Ot,ke,Ee,Gt,zt,pe,Ft,qt,k,De,K,jt,Wt,Me,Ne,Ht,Jt,fe,Rt,Qe,E,V,Se,Q,Bt,Ve,Yt,Xe,u,X,Kt,Ae,Qt,Xt,Z,Zt,ue,en,tn,nn,A,ee,on,Oe,rn,an,O,te,sn,ne,ln,Ge,dn,cn,Ze,h,oe,pn,ze,fn,un,re,hn,he,mn,gn,_n,G,ie,vn,Fe,Pn,In,z,ae,bn,se,Cn,qe,yn,xn,et;return F=new mt({}),q=new mt({}),R=new mt({}),Q=new mt({}),X=new Pe({props:{name:"class diffusers.UnCLIPPipeline",anchor:"diffusers.UnCLIPPipeline",parameters:[{name:"prior",val:": PriorTransformer"},{name:"decoder",val:": UNet2DConditionModel"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"text_proj",val:": UnCLIPTextProjModel"},{name:"super_res_first",val:": UNet2DModel"},{name:"super_res_last",val:": UNet2DModel"},{name:"prior_scheduler",val:": UnCLIPScheduler"},{name:"decoder_scheduler",val:": UnCLIPScheduler"},{name:"super_res_scheduler",val:": UnCLIPScheduler"}],parametersDescription:[{anchor:"diffusers.UnCLIPPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModelWithProjection</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.UnCLIPPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.UnCLIPPipeline.prior",description:`<strong>prior</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.PriorTransformer">PriorTransformer</a>) &#x2014;
The canonincal unCLIP prior to approximate the image embedding from the text embedding.`,name:"prior"},{anchor:"diffusers.UnCLIPPipeline.text_proj",description:`<strong>text_proj</strong> (<code>UnCLIPTextProjModel</code>) &#x2014;
Utility class to prepare and combine the embeddings before they are passed to the decoder.`,name:"text_proj"},{anchor:"diffusers.UnCLIPPipeline.decoder",description:`<strong>decoder</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
The decoder to invert the image embedding into an image.`,name:"decoder"},{anchor:"diffusers.UnCLIPPipeline.super_res_first",description:`<strong>super_res_first</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
Super resolution unet. Used in all but the last step of the super resolution diffusion process.`,name:"super_res_first"},{anchor:"diffusers.UnCLIPPipeline.super_res_last",description:`<strong>super_res_last</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
Super resolution unet. Used in the last step of the super resolution diffusion process.`,name:"super_res_last"},{anchor:"diffusers.UnCLIPPipeline.prior_scheduler",description:`<strong>prior_scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
Scheduler used in the prior denoising process. Just a modified DDPMScheduler.`,name:"prior_scheduler"},{anchor:"diffusers.UnCLIPPipeline.decoder_scheduler",description:`<strong>decoder_scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
Scheduler used in the decoder denoising process. Just a modified DDPMScheduler.`,name:"decoder_scheduler"},{anchor:"diffusers.UnCLIPPipeline.super_res_scheduler",description:`<strong>super_res_scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
Scheduler used in the super resolution denoising process. Just a modified DDPMScheduler.`,name:"super_res_scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/unclip/pipeline_unclip.py#L35"}}),ee=new Pe({props:{name:"__call__",anchor:"diffusers.UnCLIPPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"prior_num_inference_steps",val:": int = 25"},{name:"decoder_num_inference_steps",val:": int = 25"},{name:"super_res_num_inference_steps",val:": int = 7"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"prior_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"super_res_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"text_model_output",val:": typing.Union[transformers.models.clip.modeling_clip.CLIPTextModelOutput, typing.Tuple, NoneType] = None"},{name:"text_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"prior_guidance_scale",val:": float = 4.0"},{name:"decoder_guidance_scale",val:": float = 8.0"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.UnCLIPPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation. This can only be left undefined if
<code>text_model_output</code> and <code>text_attention_mask</code> is passed.`,name:"prompt"},{anchor:"diffusers.UnCLIPPipeline.__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.UnCLIPPipeline.__call__.prior_num_inference_steps",description:`<strong>prior_num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 25) &#x2014;
The number of denoising steps for the prior. More denoising steps usually lead to a higher quality
image at the expense of slower inference.`,name:"prior_num_inference_steps"},{anchor:"diffusers.UnCLIPPipeline.__call__.decoder_num_inference_steps",description:`<strong>decoder_num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 25) &#x2014;
The number of denoising steps for the decoder. More denoising steps usually lead to a higher quality
image at the expense of slower inference.`,name:"decoder_num_inference_steps"},{anchor:"diffusers.UnCLIPPipeline.__call__.super_res_num_inference_steps",description:`<strong>super_res_num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
The number of denoising steps for super resolution. More denoising steps usually lead to a higher
quality image at the expense of slower inference.`,name:"super_res_num_inference_steps"},{anchor:"diffusers.UnCLIPPipeline.__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.UnCLIPPipeline.__call__.prior_latents",description:`<strong>prior_latents</strong> (<code>torch.FloatTensor</code> of shape (batch size, embeddings dimension), <em>optional</em>) &#x2014;
Pre-generated noisy latents to be used as inputs for the prior.`,name:"prior_latents"},{anchor:"diffusers.UnCLIPPipeline.__call__.decoder_latents",description:`<strong>decoder_latents</strong> (<code>torch.FloatTensor</code> of shape (batch size, channels, height, width), <em>optional</em>) &#x2014;
Pre-generated noisy latents to be used as inputs for the decoder.`,name:"decoder_latents"},{anchor:"diffusers.UnCLIPPipeline.__call__.super_res_latents",description:`<strong>super_res_latents</strong> (<code>torch.FloatTensor</code> of shape (batch size, channels, super res height, super res width), <em>optional</em>) &#x2014;
Pre-generated noisy latents to be used as inputs for the decoder.`,name:"super_res_latents"},{anchor:"diffusers.UnCLIPPipeline.__call__.prior_guidance_scale",description:`<strong>prior_guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/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://arxiv.org/pdf/2205.11487.pdf" 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:"prior_guidance_scale"},{anchor:"diffusers.UnCLIPPipeline.__call__.decoder_guidance_scale",description:`<strong>decoder_guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/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://arxiv.org/pdf/2205.11487.pdf" 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:"decoder_guidance_scale"},{anchor:"diffusers.UnCLIPPipeline.__call__.text_model_output",description:`<strong>text_model_output</strong> (<code>CLIPTextModelOutput</code>, <em>optional</em>) &#x2014;
Pre-defined CLIPTextModel outputs that can be derived from the text encoder. Pre-defined text outputs
can be passed for tasks like text embedding interpolations. Make sure to also pass
<code>text_attention_mask</code> in this case. <code>prompt</code> can the be left to <code>None</code>.`,name:"text_model_output"},{anchor:"diffusers.UnCLIPPipeline.__call__.text_attention_mask",description:`<strong>text_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-defined CLIP text attention mask that can be derived from the tokenizer. Pre-defined text attention
masks are necessary when passing <code>text_model_output</code>.`,name:"text_attention_mask"},{anchor:"diffusers.UnCLIPPipeline.__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
<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.UnCLIPPipeline.__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/v0.12.0/en/api/diffusion_pipeline#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/unclip/pipeline_unclip.py#L252"}}),te=new Pe({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.UnCLIPPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/unclip/pipeline_unclip.py#L209"}}),oe=new Pe({props:{name:"class diffusers.UnCLIPImageVariationPipeline",anchor:"diffusers.UnCLIPImageVariationPipeline",parameters:[{name:"decoder",val:": UNet2DConditionModel"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"text_proj",val:": UnCLIPTextProjModel"},{name:"feature_extractor",val:": CLIPFeatureExtractor"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"super_res_first",val:": UNet2DModel"},{name:"super_res_last",val:": UNet2DModel"},{name:"decoder_scheduler",val:": UnCLIPScheduler"},{name:"super_res_scheduler",val:": UnCLIPScheduler"}],parametersDescription:[{anchor:"diffusers.UnCLIPImageVariationPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModelWithProjection</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.UnCLIPImageVariationPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.UnCLIPImageVariationPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPFeatureExtractor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>image_encoder</code>.`,name:"feature_extractor"},{anchor:"diffusers.UnCLIPImageVariationPipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>CLIPVisionModelWithProjection</code>) &#x2014;
Frozen CLIP image-encoder. unCLIP Image Variation uses the vision portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPVisionModelWithProjection" rel="nofollow">CLIP</a>,
specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"image_encoder"},{anchor:"diffusers.UnCLIPImageVariationPipeline.text_proj",description:`<strong>text_proj</strong> (<code>UnCLIPTextProjModel</code>) &#x2014;
Utility class to prepare and combine the embeddings before they are passed to the decoder.`,name:"text_proj"},{anchor:"diffusers.UnCLIPImageVariationPipeline.decoder",description:`<strong>decoder</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
The decoder to invert the image embedding into an image.`,name:"decoder"},{anchor:"diffusers.UnCLIPImageVariationPipeline.super_res_first",description:`<strong>super_res_first</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
Super resolution unet. Used in all but the last step of the super resolution diffusion process.`,name:"super_res_first"},{anchor:"diffusers.UnCLIPImageVariationPipeline.super_res_last",description:`<strong>super_res_last</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
Super resolution unet. Used in the last step of the super resolution diffusion process.`,name:"super_res_last"},{anchor:"diffusers.UnCLIPImageVariationPipeline.decoder_scheduler",description:`<strong>decoder_scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
Scheduler used in the decoder denoising process. Just a modified DDPMScheduler.`,name:"decoder_scheduler"},{anchor:"diffusers.UnCLIPImageVariationPipeline.super_res_scheduler",description:`<strong>super_res_scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
Scheduler used in the super resolution denoising process. Just a modified DDPMScheduler.`,name:"super_res_scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/unclip/pipeline_unclip_image_variation.py#L39"}}),ie=new Pe({props:{name:"__call__",anchor:"diffusers.UnCLIPImageVariationPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image], torch.FloatTensor, NoneType] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"decoder_num_inference_steps",val:": int = 25"},{name:"super_res_num_inference_steps",val:": int = 7"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"decoder_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"super_res_latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"image_embeddings",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_guidance_scale",val:": float = 8.0"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.UnCLIPImageVariationPipeline.__call__.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>List[PIL.Image.Image]</code> or <code>torch.FloatTensor</code>) &#x2014;
The image or images to guide the image generation. If you provide a tensor, it needs to comply with the
configuration of
<a href="https://huggingface.co/fusing/karlo-image-variations-diffusers/blob/main/feature_extractor/preprocessor_config.json" rel="nofollow">this</a>
<code>CLIPFeatureExtractor</code>. Can be left to <code>None</code> only when <code>image_embeddings</code> are passed.`,name:"image"},{anchor:"diffusers.UnCLIPImageVariationPipeline.__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.UnCLIPImageVariationPipeline.__call__.decoder_num_inference_steps",description:`<strong>decoder_num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 25) &#x2014;
The number of denoising steps for the decoder. More denoising steps usually lead to a higher quality
image at the expense of slower inference.`,name:"decoder_num_inference_steps"},{anchor:"diffusers.UnCLIPImageVariationPipeline.__call__.super_res_num_inference_steps",description:`<strong>super_res_num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
The number of denoising steps for super resolution. More denoising steps usually lead to a higher
quality image at the expense of slower inference.`,name:"super_res_num_inference_steps"},{anchor:"diffusers.UnCLIPImageVariationPipeline.__call__.generator",description:`<strong>generator</strong> (<code>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.UnCLIPImageVariationPipeline.__call__.decoder_latents",description:`<strong>decoder_latents</strong> (<code>torch.FloatTensor</code> of shape (batch size, channels, height, width), <em>optional</em>) &#x2014;
Pre-generated noisy latents to be used as inputs for the decoder.`,name:"decoder_latents"},{anchor:"diffusers.UnCLIPImageVariationPipeline.__call__.super_res_latents",description:`<strong>super_res_latents</strong> (<code>torch.FloatTensor</code> of shape (batch size, channels, super res height, super res width), <em>optional</em>) &#x2014;
Pre-generated noisy latents to be used as inputs for the decoder.`,name:"super_res_latents"},{anchor:"diffusers.UnCLIPImageVariationPipeline.__call__.decoder_guidance_scale",description:`<strong>decoder_guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/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://arxiv.org/pdf/2205.11487.pdf" 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:"decoder_guidance_scale"},{anchor:"diffusers.UnCLIPImageVariationPipeline.__call__.image_embeddings",description:`<strong>image_embeddings</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-defined image embeddings that can be derived from the image encoder. Pre-defined image embeddings
can be passed for tasks like image interpolations. <code>image</code> can the be left to <code>None</code>.`,name:"image_embeddings"},{anchor:"diffusers.UnCLIPImageVariationPipeline.__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
<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.UnCLIPImageVariationPipeline.__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/v0.12.0/en/api/diffusion_pipeline#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/unclip/pipeline_unclip_image_variation.py#L245"}}),ae=new Pe({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.UnCLIPImageVariationPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/unclip/pipeline_unclip_image_variation.py#L202"}}),{c(){x=o("meta"),je=d(),L=o("h1"),D=o("a"),Ie=o("span"),v(F.$$.fragment),gt=d(),be=o("span"),_t=s("unCLIP"),We=d(),w=o("h2"),M=o("a"),Ce=o("span"),v(q.$$.fragment),vt=d(),ye=o("span"),Pt=s("Overview"),He=d(),j=o("p"),W=o("a"),It=s("Hierarchical Text-Conditional Image Generation with CLIP Latents"),bt=s(" by Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, Mark Chen"),Je=d(),le=o("p"),Ct=s("The abstract of the paper is the following:"),Re=d(),de=o("p"),yt=s("Contrastive models like CLIP have been shown to learn robust representations of images that capture both semantics and style. To leverage these representations for image generation, we propose a two-stage model: a prior that generates a CLIP image embedding given a text caption, and a decoder that generates an image conditioned on the image embedding. We show that explicitly generating image representations improves image diversity with minimal loss in photorealism and caption similarity. Our decoders conditioned on image representations can also produce variations of an image that preserve both its semantics and style, while varying the non-essential details absent from the image representation. Moreover, the joint embedding space of CLIP enables language-guided image manipulations in a zero-shot fashion. We use diffusion models for the decoder and experiment with both autoregressive and diffusion models for the prior, finding that the latter are computationally more efficient and produce higher-quality samples."),Be=d(),m=o("p"),xt=s("The unCLIP model in diffusers comes from kakaobrain\u2019s karlo and the original codebase can be found "),H=o("a"),Lt=s("here"),wt=s(". Additionally, lucidrains has a DALL-E 2 recreation "),J=o("a"),Ut=s("here"),Tt=s("."),Ye=d(),U=o("h2"),N=o("a"),xe=o("span"),v(R.$$.fragment),$t=d(),Le=o("span"),kt=s("Available Pipelines:"),Ke=d(),S=o("table"),we=o("thead"),T=o("tr"),Ue=o("th"),Et=s("Pipeline"),Dt=d(),Te=o("th"),Mt=s("Tasks"),Nt=d(),ce=o("th"),St=s("Colab"),Vt=d(),B=o("tbody"),$=o("tr"),$e=o("td"),Y=o("a"),At=s("pipeline_unclip.py"),Ot=d(),ke=o("td"),Ee=o("em"),Gt=s("Text-to-Image Generation"),zt=d(),pe=o("td"),Ft=s("-"),qt=d(),k=o("tr"),De=o("td"),K=o("a"),jt=s("pipeline_unclip_image_variation.py"),Wt=d(),Me=o("td"),Ne=o("em"),Ht=s("Image-Guided Image Generation"),Jt=d(),fe=o("td"),Rt=s("-"),Qe=d(),E=o("h2"),V=o("a"),Se=o("span"),v(Q.$$.fragment),Bt=d(),Ve=o("span"),Yt=s("UnCLIPPipeline"),Xe=d(),u=o("div"),v(X.$$.fragment),Kt=d(),Ae=o("p"),Qt=s("Pipeline for text-to-image generation using unCLIP"),Xt=d(),Z=o("p"),Zt=s("This model inherits from "),ue=o("a"),en=s("DiffusionPipeline"),tn=s(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),nn=d(),A=o("div"),v(ee.$$.fragment),on=d(),Oe=o("p"),rn=s("Function invoked when calling the pipeline for generation."),an=d(),O=o("div"),v(te.$$.fragment),sn=d(),ne=o("p"),ln=s(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Ge=o("code"),dn=s("torch.device('meta') and loaded to GPU only when their specific submodule has its "),cn=s("forward` method called."),Ze=d(),h=o("div"),v(oe.$$.fragment),pn=d(),ze=o("p"),fn=s("Pipeline to generate variations from an input image using unCLIP"),un=d(),re=o("p"),hn=s("This model inherits from "),he=o("a"),mn=s("DiffusionPipeline"),gn=s(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),_n=d(),G=o("div"),v(ie.$$.fragment),vn=d(),Fe=o("p"),Pn=s("Function invoked when calling the pipeline for generation."),In=d(),z=o("div"),v(ae.$$.fragment),bn=d(),se=o("p"),Cn=s(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),qe=o("code"),yn=s("torch.device('meta') and loaded to GPU only when their specific submodule has its "),xn=s("forward` method called."),this.h()},l(t){const p=go('[data-svelte="svelte-1phssyn"]',document.head);x=r(p,"META",{name:!0,content:!0}),p.forEach(n),je=c(t),L=r(t,"H1",{class:!0});var tt=i(L);D=r(tt,"A",{id:!0,class:!0,href:!0});var Un=i(D);Ie=r(Un,"SPAN",{});var Tn=i(Ie);P(F.$$.fragment,Tn),Tn.forEach(n),Un.forEach(n),gt=c(tt),be=r(tt,"SPAN",{});var $n=i(be);_t=l($n,"unCLIP"),$n.forEach(n),tt.forEach(n),We=c(t),w=r(t,"H2",{class:!0});var nt=i(w);M=r(nt,"A",{id:!0,class:!0,href:!0});var kn=i(M);Ce=r(kn,"SPAN",{});var En=i(Ce);P(q.$$.fragment,En),En.forEach(n),kn.forEach(n),vt=c(nt),ye=r(nt,"SPAN",{});var Dn=i(ye);Pt=l(Dn,"Overview"),Dn.forEach(n),nt.forEach(n),He=c(t),j=r(t,"P",{});var Ln=i(j);W=r(Ln,"A",{href:!0,rel:!0});var Mn=i(W);It=l(Mn,"Hierarchical Text-Conditional Image Generation with CLIP Latents"),Mn.forEach(n),bt=l(Ln," by Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, Mark Chen"),Ln.forEach(n),Je=c(t),le=r(t,"P",{});var Nn=i(le);Ct=l(Nn,"The abstract of the paper is the following:"),Nn.forEach(n),Re=c(t),de=r(t,"P",{});var Sn=i(de);yt=l(Sn,"Contrastive models like CLIP have been shown to learn robust representations of images that capture both semantics and style. To leverage these representations for image generation, we propose a two-stage model: a prior that generates a CLIP image embedding given a text caption, and a decoder that generates an image conditioned on the image embedding. We show that explicitly generating image representations improves image diversity with minimal loss in photorealism and caption similarity. Our decoders conditioned on image representations can also produce variations of an image that preserve both its semantics and style, while varying the non-essential details absent from the image representation. Moreover, the joint embedding space of CLIP enables language-guided image manipulations in a zero-shot fashion. We use diffusion models for the decoder and experiment with both autoregressive and diffusion models for the prior, finding that the latter are computationally more efficient and produce higher-quality samples."),Sn.forEach(n),Be=c(t),m=r(t,"P",{});var me=i(m);xt=l(me,"The unCLIP model in diffusers comes from kakaobrain\u2019s karlo and the original codebase can be found "),H=r(me,"A",{href:!0,rel:!0});var Vn=i(H);Lt=l(Vn,"here"),Vn.forEach(n),wt=l(me,". Additionally, lucidrains has a DALL-E 2 recreation "),J=r(me,"A",{href:!0,rel:!0});var An=i(J);Ut=l(An,"here"),An.forEach(n),Tt=l(me,"."),me.forEach(n),Ye=c(t),U=r(t,"H2",{class:!0});var ot=i(U);N=r(ot,"A",{id:!0,class:!0,href:!0});var On=i(N);xe=r(On,"SPAN",{});var Gn=i(xe);P(R.$$.fragment,Gn),Gn.forEach(n),On.forEach(n),$t=c(ot),Le=r(ot,"SPAN",{});var zn=i(Le);kt=l(zn,"Available Pipelines:"),zn.forEach(n),ot.forEach(n),Ke=c(t),S=r(t,"TABLE",{});var rt=i(S);we=r(rt,"THEAD",{});var Fn=i(we);T=r(Fn,"TR",{});var ge=i(T);Ue=r(ge,"TH",{});var qn=i(Ue);Et=l(qn,"Pipeline"),qn.forEach(n),Dt=c(ge),Te=r(ge,"TH",{});var jn=i(Te);Mt=l(jn,"Tasks"),jn.forEach(n),Nt=c(ge),ce=r(ge,"TH",{align:!0});var Wn=i(ce);St=l(Wn,"Colab"),Wn.forEach(n),ge.forEach(n),Fn.forEach(n),Vt=c(rt),B=r(rt,"TBODY",{});var it=i(B);$=r(it,"TR",{});var _e=i($);$e=r(_e,"TD",{});var Hn=i($e);Y=r(Hn,"A",{href:!0,rel:!0});var Jn=i(Y);At=l(Jn,"pipeline_unclip.py"),Jn.forEach(n),Hn.forEach(n),Ot=c(_e),ke=r(_e,"TD",{});var Rn=i(ke);Ee=r(Rn,"EM",{});var Bn=i(Ee);Gt=l(Bn,"Text-to-Image Generation"),Bn.forEach(n),Rn.forEach(n),zt=c(_e),pe=r(_e,"TD",{align:!0});var Yn=i(pe);Ft=l(Yn,"-"),Yn.forEach(n),_e.forEach(n),qt=c(it),k=r(it,"TR",{});var ve=i(k);De=r(ve,"TD",{});var Kn=i(De);K=r(Kn,"A",{href:!0,rel:!0});var Qn=i(K);jt=l(Qn,"pipeline_unclip_image_variation.py"),Qn.forEach(n),Kn.forEach(n),Wt=c(ve),Me=r(ve,"TD",{});var Xn=i(Me);Ne=r(Xn,"EM",{});var Zn=i(Ne);Ht=l(Zn,"Image-Guided Image Generation"),Zn.forEach(n),Xn.forEach(n),Jt=c(ve),fe=r(ve,"TD",{align:!0});var eo=i(fe);Rt=l(eo,"-"),eo.forEach(n),ve.forEach(n),it.forEach(n),rt.forEach(n),Qe=c(t),E=r(t,"H2",{class:!0});var at=i(E);V=r(at,"A",{id:!0,class:!0,href:!0});var to=i(V);Se=r(to,"SPAN",{});var no=i(Se);P(Q.$$.fragment,no),no.forEach(n),to.forEach(n),Bt=c(at),Ve=r(at,"SPAN",{});var oo=i(Ve);Yt=l(oo,"UnCLIPPipeline"),oo.forEach(n),at.forEach(n),Xe=c(t),u=r(t,"DIV",{class:!0});var g=i(u);P(X.$$.fragment,g),Kt=c(g),Ae=r(g,"P",{});var ro=i(Ae);Qt=l(ro,"Pipeline for text-to-image generation using unCLIP"),ro.forEach(n),Xt=c(g),Z=r(g,"P",{});var st=i(Z);Zt=l(st,"This model inherits from "),ue=r(st,"A",{href:!0});var io=i(ue);en=l(io,"DiffusionPipeline"),io.forEach(n),tn=l(st,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),st.forEach(n),nn=c(g),A=r(g,"DIV",{class:!0});var lt=i(A);P(ee.$$.fragment,lt),on=c(lt),Oe=r(lt,"P",{});var ao=i(Oe);rn=l(ao,"Function invoked when calling the pipeline for generation."),ao.forEach(n),lt.forEach(n),an=c(g),O=r(g,"DIV",{class:!0});var dt=i(O);P(te.$$.fragment,dt),sn=c(dt),ne=r(dt,"P",{});var ct=i(ne);ln=l(ct,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Ge=r(ct,"CODE",{});var so=i(Ge);dn=l(so,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),so.forEach(n),cn=l(ct,"forward` method called."),ct.forEach(n),dt.forEach(n),g.forEach(n),Ze=c(t),h=r(t,"DIV",{class:!0});var _=i(h);P(oe.$$.fragment,_),pn=c(_),ze=r(_,"P",{});var lo=i(ze);fn=l(lo,"Pipeline to generate variations from an input image using unCLIP"),lo.forEach(n),un=c(_),re=r(_,"P",{});var pt=i(re);hn=l(pt,"This model inherits from "),he=r(pt,"A",{href:!0});var co=i(he);mn=l(co,"DiffusionPipeline"),co.forEach(n),gn=l(pt,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),pt.forEach(n),_n=c(_),G=r(_,"DIV",{class:!0});var ft=i(G);P(ie.$$.fragment,ft),vn=c(ft),Fe=r(ft,"P",{});var po=i(Fe);Pn=l(po,"Function invoked when calling the pipeline for generation."),po.forEach(n),ft.forEach(n),In=c(_),z=r(_,"DIV",{class:!0});var ut=i(z);P(ae.$$.fragment,ut),bn=c(ut),se=r(ut,"P",{});var ht=i(se);Cn=l(ht,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),qe=r(ht,"CODE",{});var fo=i(qe);yn=l(fo,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),fo.forEach(n),xn=l(ht,"forward` method called."),ht.forEach(n),ut.forEach(n),_.forEach(n),this.h()},h(){a(x,"name","hf:doc:metadata"),a(x,"content",JSON.stringify(Io)),a(D,"id","unclip"),a(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),a(D,"href","#unclip"),a(L,"class","relative group"),a(M,"id","overview"),a(M,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),a(M,"href","#overview"),a(w,"class","relative group"),a(W,"href","https://arxiv.org/abs/2204.06125"),a(W,"rel","nofollow"),a(H,"href","https://github.com/kakaobrain/karlo"),a(H,"rel","nofollow"),a(J,"href","https://github.com/lucidrains/DALLE2-pytorch"),a(J,"rel","nofollow"),a(N,"id","available-pipelines"),a(N,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),a(N,"href","#available-pipelines"),a(U,"class","relative group"),a(ce,"align","center"),a(Y,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/unclip/pipeline_unclip.py"),a(Y,"rel","nofollow"),a(pe,"align","center"),a(K,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/unclip/pipeline_unclip_image_variation.py"),a(K,"rel","nofollow"),a(fe,"align","center"),a(V,"id","diffusers.UnCLIPPipeline"),a(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),a(V,"href","#diffusers.UnCLIPPipeline"),a(E,"class","relative group"),a(ue,"href","/docs/diffusers/v0.12.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),a(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(he,"href","/docs/diffusers/v0.12.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),a(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,x),f(t,je,p),f(t,L,p),e(L,D),e(D,Ie),I(F,Ie,null),e(L,gt),e(L,be),e(be,_t),f(t,We,p),f(t,w,p),e(w,M),e(M,Ce),I(q,Ce,null),e(w,vt),e(w,ye),e(ye,Pt),f(t,He,p),f(t,j,p),e(j,W),e(W,It),e(j,bt),f(t,Je,p),f(t,le,p),e(le,Ct),f(t,Re,p),f(t,de,p),e(de,yt),f(t,Be,p),f(t,m,p),e(m,xt),e(m,H),e(H,Lt),e(m,wt),e(m,J),e(J,Ut),e(m,Tt),f(t,Ye,p),f(t,U,p),e(U,N),e(N,xe),I(R,xe,null),e(U,$t),e(U,Le),e(Le,kt),f(t,Ke,p),f(t,S,p),e(S,we),e(we,T),e(T,Ue),e(Ue,Et),e(T,Dt),e(T,Te),e(Te,Mt),e(T,Nt),e(T,ce),e(ce,St),e(S,Vt),e(S,B),e(B,$),e($,$e),e($e,Y),e(Y,At),e($,Ot),e($,ke),e(ke,Ee),e(Ee,Gt),e($,zt),e($,pe),e(pe,Ft),e(B,qt),e(B,k),e(k,De),e(De,K),e(K,jt),e(k,Wt),e(k,Me),e(Me,Ne),e(Ne,Ht),e(k,Jt),e(k,fe),e(fe,Rt),f(t,Qe,p),f(t,E,p),e(E,V),e(V,Se),I(Q,Se,null),e(E,Bt),e(E,Ve),e(Ve,Yt),f(t,Xe,p),f(t,u,p),I(X,u,null),e(u,Kt),e(u,Ae),e(Ae,Qt),e(u,Xt),e(u,Z),e(Z,Zt),e(Z,ue),e(ue,en),e(Z,tn),e(u,nn),e(u,A),I(ee,A,null),e(A,on),e(A,Oe),e(Oe,rn),e(u,an),e(u,O),I(te,O,null),e(O,sn),e(O,ne),e(ne,ln),e(ne,Ge),e(Ge,dn),e(ne,cn),f(t,Ze,p),f(t,h,p),I(oe,h,null),e(h,pn),e(h,ze),e(ze,fn),e(h,un),e(h,re),e(re,hn),e(re,he),e(he,mn),e(re,gn),e(h,_n),e(h,G),I(ie,G,null),e(G,vn),e(G,Fe),e(Fe,Pn),e(h,In),e(h,z),I(ae,z,null),e(z,bn),e(z,se),e(se,Cn),e(se,qe),e(qe,yn),e(se,xn),et=!0},p:_o,i(t){et||(b(F.$$.fragment,t),b(q.$$.fragment,t),b(R.$$.fragment,t),b(Q.$$.fragment,t),b(X.$$.fragment,t),b(ee.$$.fragment,t),b(te.$$.fragment,t),b(oe.$$.fragment,t),b(ie.$$.fragment,t),b(ae.$$.fragment,t),et=!0)},o(t){C(F.$$.fragment,t),C(q.$$.fragment,t),C(R.$$.fragment,t),C(Q.$$.fragment,t),C(X.$$.fragment,t),C(ee.$$.fragment,t),C(te.$$.fragment,t),C(oe.$$.fragment,t),C(ie.$$.fragment,t),C(ae.$$.fragment,t),et=!1},d(t){n(x),t&&n(je),t&&n(L),y(F),t&&n(We),t&&n(w),y(q),t&&n(He),t&&n(j),t&&n(Je),t&&n(le),t&&n(Re),t&&n(de),t&&n(Be),t&&n(m),t&&n(Ye),t&&n(U),y(R),t&&n(Ke),t&&n(S),t&&n(Qe),t&&n(E),y(Q),t&&n(Xe),t&&n(u),y(X),y(ee),y(te),t&&n(Ze),t&&n(h),y(oe),y(ie),y(ae)}}}const Io={local:"unclip",sections:[{local:"overview",title:"Overview"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"diffusers.UnCLIPPipeline",title:"UnCLIPPipeline"}],title:"unCLIP"};function bo(wn){return vo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Lo extends uo{constructor(x){super();ho(this,x,bo,Po,mo,{})}}export{Lo as default,Io as metadata};
