import{s as Le,o as Ye,n as Se}from"../chunks/scheduler.8c3d61f6.js";import{S as ze,i as De,g as a,s as n,r as u,A as Xe,h as r,f as o,c as l,j as H,u as g,x as f,k as A,y as m,a as s,v as h,d as M,t as _,w as b}from"../chunks/index.da70eac4.js";import{T as Ge}from"../chunks/Tip.1d9b8c37.js";import{D as xe}from"../chunks/Docstring.6b390b9a.js";import{C as Ve}from"../chunks/CodeBlock.00a903b3.js";import{H as Me,E as qe}from"../chunks/EditOnGithub.1e64e623.js";function Be(Y){let i,y='Using an IP Adapter with Kolors requires more than 24GB of VRAM. To use it, we recommend using <a href="/docs/diffusers/v0.30.3/en/api/pipelines/overview#diffusers.DiffusionPipeline.enable_model_cpu_offload">enable_model_cpu_offload()</a> on consumer GPUs.';return{c(){i=a("p"),i.innerHTML=y},l(d){i=r(d,"P",{"data-svelte-h":!0}),f(i)!=="svelte-1ctp4ed"&&(i.innerHTML=y)},m(d,v){s(d,i,v)},p:Se,d(d){d&&o(i)}}}function Ne(Y){let i,y="While Kolors is integrated in Diffusers, you need to load the image encoder from a revision to use the safetensor files. You can still use the main branch of the original repository if you’re comfortable loading pickle checkpoints.";return{c(){i=a("p"),i.textContent=y},l(d){i=r(d,"P",{"data-svelte-h":!0}),f(i)!=="svelte-lkmklu"&&(i.textContent=y)},m(d,v){s(d,i,v)},p:Se,d(d){d&&o(i)}}}function Fe(Y){let i,y,d,v,x,O,k,ke='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/kolors/kolors_header_collage.png"/>',ee,j,je='Kolors is a large-scale text-to-image generation model based on latent diffusion, developed by <a href="kwai-kolors@kuaishou.com">the Kuaishou Kolors team</a>. Trained on billions of text-image pairs, Kolors exhibits significant advantages over both open-source and closed-source models in visual quality, complex semantic accuracy, and text rendering for both Chinese and English characters. Furthermore, Kolors supports both Chinese and English inputs, demonstrating strong performance in understanding and generating Chinese-specific content. For more details, please refer to this <a href="https://github.com/Kwai-Kolors/Kolors/blob/master/imgs/Kolors_paper.pdf" rel="nofollow">technical report</a>.',te,C,Ce="The abstract from the technical report is:",oe,$,$e='<em>We present Kolors, a latent diffusion model for text-to-image synthesis, characterized by its profound understanding of both English and Chinese, as well as an impressive degree of photorealism. There are three key insights contributing to the development of Kolors. Firstly, unlike large language model T5 used in Imagen and Stable Diffusion 3, Kolors is built upon the General Language Model (GLM), which enhances its comprehension capabilities in both English and Chinese. Moreover, we employ a multimodal large language model to recaption the extensive training dataset for fine-grained text understanding. These strategies significantly improve Kolors’ ability to comprehend intricate semantics, particularly those involving multiple entities, and enable its advanced text rendering capabilities. Secondly, we divide the training of Kolors into two phases: the concept learning phase with broad knowledge and the quality improvement phase with specifically curated high-aesthetic data. Furthermore, we investigate the critical role of the noise schedule and introduce a novel schedule to optimize high-resolution image generation. These strategies collectively enhance the visual appeal of the generated high-resolution images. Lastly, we propose a category-balanced benchmark KolorsPrompts, which serves as a guide for the training and evaluation of Kolors. Consequently, even when employing the commonly used U-Net backbone, Kolors has demonstrated remarkable performance in human evaluations, surpassing the existing open-source models and achieving Midjourney-v6 level performance, especially in terms of visual appeal. We will release the code and weights of Kolors at <a href="https://github.com/Kwai-Kolors/Kolors" rel="nofollow">https://github.com/Kwai-Kolors/Kolors</a>, and hope that it will benefit future research and applications in the visual generation community.</em>',se,Z,ne,I,le,Q,ie,E,Ze='Kolors needs a different IP Adapter to work, and it uses <a href="https://huggingface.co/openai/clip-vit-large-patch14-336" rel="nofollow">Openai-CLIP-336</a> as an image encoder.',ae,U,re,w,pe,K,de,R,ce,p,W,_e,z,Ie="Pipeline for text-to-image generation using Kolors.",be,D,Qe=`This model inherits from <a href="/docs/diffusers/v0.30.3/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`,ye,X,Ee="The pipeline also inherits the following loading methods:",ve,q,Ke='<li><a href="/docs/diffusers/v0.30.3/en/api/loaders/lora#diffusers.loaders.StableDiffusionXLLoraLoaderMixin.load_lora_weights">load_lora_weights()</a> for loading LoRA weights</li> <li><a href="/docs/diffusers/v0.30.3/en/api/loaders/lora#diffusers.loaders.StableDiffusionXLLoraLoaderMixin.save_lora_weights">save_lora_weights()</a> for saving LoRA weights</li> <li><a href="/docs/diffusers/v0.30.3/en/api/loaders/ip_adapter#diffusers.loaders.IPAdapterMixin.load_ip_adapter">load_ip_adapter()</a> for loading IP Adapters</li>',Ue,T,P,we,B,Re="Encodes the prompt into text encoder hidden states.",Te,J,G,Je,N,We='See <a href="https://github.com/google-research/vdm/blob/dc27b98a554f65cdc654b800da5aa1846545d41b/model_vdm.py#L298" rel="nofollow">https://github.com/google-research/vdm/blob/dc27b98a554f65cdc654b800da5aa1846545d41b/model_vdm.py#L298</a>',me,V,Pe="<li>all</li> <li><strong>call</strong></li>",fe,S,ue,F,ge;return x=new Me({props:{title:"Kolors: Effective Training of Diffusion Model for Photorealistic Text-to-Image Synthesis",local:"kolors-effective-training-of-diffusion-model-for-photorealistic-text-to-image-synthesis",headingTag:"h1"}}),Z=new Me({props:{title:"Usage Example",local:"usage-example",headingTag:"h2"}}),I=new Ve({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRFBNU29sdmVyTXVsdGlzdGVwU2NoZWR1bGVyJTJDJTIwS29sb3JzUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwS29sb3JzUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkt3YWktS29sb3JzJTJGS29sb3JzLWRpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyKSUwQXBpcGUudG8oJTIyY3VkYSUyMiklMEFwaXBlLnNjaGVkdWxlciUyMCUzRCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlci5mcm9tX2NvbmZpZyhwaXBlLnNjaGVkdWxlci5jb25maWclMkMlMjB1c2Vfa2FycmFzX3NpZ21hcyUzRFRydWUpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCclRTQlQjglODAlRTUlQkMlQTAlRTclOTMlQTIlRTglOTklQUIlRTclOUElODQlRTclODUlQTclRTclODklODclRUYlQkMlOEMlRTUlQkUlQUUlRTglQjclOUQlRUYlQkMlOEMlRTUlOEYlOTglRTclODQlQTYlRUYlQkMlOEMlRTklQUIlOTglRTglQjQlQTglRTklODclOEYlRUYlQkMlOEMlRTclOTQlQjUlRTUlQkQlQjElRUYlQkMlOEMlRTYlOEIlQkYlRTclOUQlODAlRTQlQjglODAlRTQlQjglQUElRTclODklOEMlRTUlQUQlOTAlRUYlQkMlOEMlRTUlODYlOTklRTclOUQlODAlMjIlRTUlOEYlQUYlRTUlOUIlQkUlMjInJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEJTIyJTIyJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q2LjUlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjUlMkMlMEEpLmltYWdlcyU1QjAlNUQlMEElMEFpbWFnZS5zYXZlKCUyMmtvbG9yc19zYW1wbGUucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler, KolorsPipeline

pipe = KolorsPipeline.from_pretrained(<span class="hljs-string">&quot;Kwai-Kolors/Kolors-diffusers&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, use_karras_sigmas=<span class="hljs-literal">True</span>)

image = pipe(
    prompt=<span class="hljs-string">&#x27;一张瓢虫的照片，微距，变焦，高质量，电影，拿着一个牌子，写着&quot;可图&quot;&#x27;</span>,
    negative_prompt=<span class="hljs-string">&quot;&quot;</span>,
    guidance_scale=<span class="hljs-number">6.5</span>,
    num_inference_steps=<span class="hljs-number">25</span>,
).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;kolors_sample.png&quot;</span>)`,wrap:!1}}),Q=new Me({props:{title:"IP Adapter",local:"ip-adapter",headingTag:"h3"}}),U=new Ge({props:{$$slots:{default:[Be]},$$scope:{ctx:Y}}}),w=new Ge({props:{$$slots:{default:[Ne]},$$scope:{ctx:Y}}}),K=new Ve({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQ0xJUFZpc2lvbk1vZGVsV2l0aFByb2plY3Rpb24lMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRFBNU29sdmVyTXVsdGlzdGVwU2NoZWR1bGVyJTJDJTIwS29sb3JzUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQWltYWdlX2VuY29kZXIlMjAlM0QlMjBDTElQVmlzaW9uTW9kZWxXaXRoUHJvamVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyS3dhaS1Lb2xvcnMlMkZLb2xvcnMtSVAtQWRhcHRlci1QbHVzJTIyJTJDJTBBJTIwJTIwJTIwJTIwc3ViZm9sZGVyJTNEJTIyaW1hZ2VfZW5jb2RlciUyMiUyQyUwQSUyMCUyMCUyMCUyMGxvd19jcHVfbWVtX3VzYWdlJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUwQSUyMCUyMCUyMCUyMHJldmlzaW9uJTNEJTIycmVmcyUyRnByJTJGNCUyMiUyQyUwQSklMEElMEFwaXBlJTIwJTNEJTIwS29sb3JzUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMkt3YWktS29sb3JzJTJGS29sb3JzLWRpZmZ1c2VycyUyMiUyQyUyMGltYWdlX2VuY29kZXIlM0RpbWFnZV9lbmNvZGVyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMEEpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZS5zY2hlZHVsZXIlMjAlM0QlMjBEUE1Tb2x2ZXJNdWx0aXN0ZXBTY2hlZHVsZXIuZnJvbV9jb25maWcocGlwZS5zY2hlZHVsZXIuY29uZmlnJTJDJTIwdXNlX2thcnJhc19zaWdtYXMlM0RUcnVlKSUwQSUwQXBpcGUubG9hZF9pcF9hZGFwdGVyKCUwQSUyMCUyMCUyMCUyMCUyMkt3YWktS29sb3JzJTJGS29sb3JzLUlQLUFkYXB0ZXItUGx1cyUyMiUyQyUwQSUyMCUyMCUyMCUyMHN1YmZvbGRlciUzRCUyMiUyMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9uYW1lJTNEJTIyaXBfYWRhcHRlcl9wbHVzX2dlbmVyYWwuc2FmZXRlbnNvcnMlMjIlMkMlMEElMjAlMjAlMjAlMjByZXZpc2lvbiUzRCUyMnJlZnMlMkZwciUyRjQlMjIlMkMlMEElMjAlMjAlMjAlMjBpbWFnZV9lbmNvZGVyX2ZvbGRlciUzRE5vbmUlMkMlMEEpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQWlwYV9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGa29sb3JzJTJGY2F0X3NxdWFyZS5wbmclMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMmJlc3QlMjBxdWFsaXR5JTJDJTIwaGlnaCUyMHF1YWxpdHklMjIlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9wcm9tcHQlM0QlMjIlMjIlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDYuNSUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyNSUyQyUwQSUyMCUyMCUyMCUyMGlwX2FkYXB0ZXJfaW1hZ2UlM0RpcGFfaW1hZ2UlMkMlMEEpLmltYWdlcyU1QjAlNUQlMEElMEFpbWFnZS5zYXZlKCUyMmtvbG9yc19pcGFfc2FtcGxlLnBuZyUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModelWithProjection

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

image_encoder = CLIPVisionModelWithProjection.from_pretrained(
    <span class="hljs-string">&quot;Kwai-Kolors/Kolors-IP-Adapter-Plus&quot;</span>,
    subfolder=<span class="hljs-string">&quot;image_encoder&quot;</span>,
    low_cpu_mem_usage=<span class="hljs-literal">True</span>,
    torch_dtype=torch.float16,
    revision=<span class="hljs-string">&quot;refs/pr/4&quot;</span>,
)

pipe = KolorsPipeline.from_pretrained(
    <span class="hljs-string">&quot;Kwai-Kolors/Kolors-diffusers&quot;</span>, image_encoder=image_encoder, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, use_karras_sigmas=<span class="hljs-literal">True</span>)

pipe.load_ip_adapter(
    <span class="hljs-string">&quot;Kwai-Kolors/Kolors-IP-Adapter-Plus&quot;</span>,
    subfolder=<span class="hljs-string">&quot;&quot;</span>,
    weight_name=<span class="hljs-string">&quot;ip_adapter_plus_general.safetensors&quot;</span>,
    revision=<span class="hljs-string">&quot;refs/pr/4&quot;</span>,
    image_encoder_folder=<span class="hljs-literal">None</span>,
)
pipe.enable_model_cpu_offload()

ipa_image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/kolors/cat_square.png&quot;</span>)

image = pipe(
    prompt=<span class="hljs-string">&quot;best quality, high quality&quot;</span>,
    negative_prompt=<span class="hljs-string">&quot;&quot;</span>,
    guidance_scale=<span class="hljs-number">6.5</span>,
    num_inference_steps=<span class="hljs-number">25</span>,
    ip_adapter_image=ipa_image,
).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;kolors_ipa_sample.png&quot;</span>)`,wrap:!1}}),R=new Me({props:{title:"KolorsPipeline",local:"diffusers.KolorsPipeline",headingTag:"h2"}}),W=new xe({props:{name:"class diffusers.KolorsPipeline",anchor:"diffusers.KolorsPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": ChatGLMModel"},{name:"tokenizer",val:": ChatGLMTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"image_encoder",val:": CLIPVisionModelWithProjection = None"},{name:"feature_extractor",val:": CLIPImageProcessor = None"},{name:"force_zeros_for_empty_prompt",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.KolorsPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.30.3/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.KolorsPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>ChatGLMModel</code>) &#x2014;
Frozen text-encoder. Kolors uses <a href="https://huggingface.co/THUDM/chatglm3-6b" rel="nofollow">ChatGLM3-6B</a>.`,name:"text_encoder"},{anchor:"diffusers.KolorsPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>ChatGLMTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/THUDM/chatglm3-6b/blob/main/tokenization_chatglm.py" rel="nofollow">ChatGLMTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.KolorsPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.30.3/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.KolorsPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.30.3/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/v0.30.3/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.30.3/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.30.3/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.KolorsPipeline.force_zeros_for_empty_prompt",description:`<strong>force_zeros_for_empty_prompt</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>&quot;False&quot;</code>) &#x2014;
Whether the negative prompt embeddings shall be forced to always be set to 0. Also see the config of
<code>Kwai-Kolors/Kolors-diffusers</code>.`,name:"force_zeros_for_empty_prompt"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.3/src/diffusers/pipelines/kolors/pipeline_kolors.py#L124"}}),P=new xe({props:{name:"encode_prompt",anchor:"diffusers.KolorsPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:": Optional = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": Optional = None"},{name:"pooled_prompt_embeds",val:": Optional = None"},{name:"negative_prompt_embeds",val:": Optional = None"},{name:"negative_pooled_prompt_embeds",val:": Optional = None"},{name:"max_sequence_length",val:": int = 256"}],parametersDescription:[{anchor:"diffusers.KolorsPipeline.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.KolorsPipeline.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.KolorsPipeline.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.KolorsPipeline.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.KolorsPipeline.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.KolorsPipeline.encode_prompt.pooled_prompt_embeds",description:`<strong>pooled_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting.
If not provided, pooled text embeddings will be generated from <code>prompt</code> input argument.`,name:"pooled_prompt_embeds"},{anchor:"diffusers.KolorsPipeline.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.KolorsPipeline.encode_prompt.negative_pooled_prompt_embeds",description:`<strong>negative_pooled_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from <code>negative_prompt</code>
input argument.`,name:"negative_pooled_prompt_embeds"},{anchor:"diffusers.KolorsPipeline.encode_prompt.max_sequence_length",description:"<strong>max_sequence_length</strong> (<code>int</code> defaults to 256) &#x2014; Maximum sequence length to use with the <code>prompt</code>.",name:"max_sequence_length"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.3/src/diffusers/pipelines/kolors/pipeline_kolors.py#L198"}}),G=new xe({props:{name:"get_guidance_scale_embedding",anchor:"diffusers.KolorsPipeline.get_guidance_scale_embedding",parameters:[{name:"w",val:": Tensor"},{name:"embedding_dim",val:": int = 512"},{name:"dtype",val:": dtype = torch.float32"}],parametersDescription:[{anchor:"diffusers.KolorsPipeline.get_guidance_scale_embedding.w",description:`<strong>w</strong> (<code>torch.Tensor</code>) &#x2014;
Generate embedding vectors with a specified guidance scale to subsequently enrich timestep embeddings.`,name:"w"},{anchor:"diffusers.KolorsPipeline.get_guidance_scale_embedding.embedding_dim",description:`<strong>embedding_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimension of the embeddings to generate.`,name:"embedding_dim"},{anchor:"diffusers.KolorsPipeline.get_guidance_scale_embedding.dtype",description:`<strong>dtype</strong> (<code>torch.dtype</code>, <em>optional</em>, defaults to <code>torch.float32</code>) &#x2014;
Data type of the generated embeddings.`,name:"dtype"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.3/src/diffusers/pipelines/kolors/pipeline_kolors.py#L599",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Embedding vectors with shape <code>(len(w), embedding_dim)</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),S=new qe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/kolors.md"}}),{c(){i=a("meta"),y=n(),d=a("p"),v=n(),u(x.$$.fragment),O=n(),k=a("p"),k.innerHTML=ke,ee=n(),j=a("p"),j.innerHTML=je,te=n(),C=a("p"),C.textContent=Ce,oe=n(),$=a("p"),$.innerHTML=$e,se=n(),u(Z.$$.fragment),ne=n(),u(I.$$.fragment),le=n(),u(Q.$$.fragment),ie=n(),E=a("p"),E.innerHTML=Ze,ae=n(),u(U.$$.fragment),re=n(),u(w.$$.fragment),pe=n(),u(K.$$.fragment),de=n(),u(R.$$.fragment),ce=n(),p=a("div"),u(W.$$.fragment),_e=n(),z=a("p"),z.textContent=Ie,be=n(),D=a("p"),D.innerHTML=Qe,ye=n(),X=a("p"),X.textContent=Ee,ve=n(),q=a("ul"),q.innerHTML=Ke,Ue=n(),T=a("div"),u(P.$$.fragment),we=n(),B=a("p"),B.textContent=Re,Te=n(),J=a("div"),u(G.$$.fragment),Je=n(),N=a("p"),N.innerHTML=We,me=n(),V=a("ul"),V.innerHTML=Pe,fe=n(),u(S.$$.fragment),ue=n(),F=a("p"),this.h()},l(e){const t=Xe("svelte-u9bgzb",document.head);i=r(t,"META",{name:!0,content:!0}),t.forEach(o),y=l(e),d=r(e,"P",{}),H(d).forEach(o),v=l(e),g(x.$$.fragment,e),O=l(e),k=r(e,"P",{"data-svelte-h":!0}),f(k)!=="svelte-1hwlqdw"&&(k.innerHTML=ke),ee=l(e),j=r(e,"P",{"data-svelte-h":!0}),f(j)!=="svelte-1g43t28"&&(j.innerHTML=je),te=l(e),C=r(e,"P",{"data-svelte-h":!0}),f(C)!=="svelte-nj72pd"&&(C.textContent=Ce),oe=l(e),$=r(e,"P",{"data-svelte-h":!0}),f($)!=="svelte-vvt3t7"&&($.innerHTML=$e),se=l(e),g(Z.$$.fragment,e),ne=l(e),g(I.$$.fragment,e),le=l(e),g(Q.$$.fragment,e),ie=l(e),E=r(e,"P",{"data-svelte-h":!0}),f(E)!=="svelte-1a6xano"&&(E.innerHTML=Ze),ae=l(e),g(U.$$.fragment,e),re=l(e),g(w.$$.fragment,e),pe=l(e),g(K.$$.fragment,e),de=l(e),g(R.$$.fragment,e),ce=l(e),p=r(e,"DIV",{class:!0});var c=H(p);g(W.$$.fragment,c),_e=l(c),z=r(c,"P",{"data-svelte-h":!0}),f(z)!=="svelte-d2bqje"&&(z.textContent=Ie),be=l(c),D=r(c,"P",{"data-svelte-h":!0}),f(D)!=="svelte-1hljmsw"&&(D.innerHTML=Qe),ye=l(c),X=r(c,"P",{"data-svelte-h":!0}),f(X)!=="svelte-14s6m4u"&&(X.textContent=Ee),ve=l(c),q=r(c,"UL",{"data-svelte-h":!0}),f(q)!=="svelte-uignvt"&&(q.innerHTML=Ke),Ue=l(c),T=r(c,"DIV",{class:!0});var L=H(T);g(P.$$.fragment,L),we=l(L),B=r(L,"P",{"data-svelte-h":!0}),f(B)!=="svelte-16q0ax1"&&(B.textContent=Re),L.forEach(o),Te=l(c),J=r(c,"DIV",{class:!0});var he=H(J);g(G.$$.fragment,he),Je=l(he),N=r(he,"P",{"data-svelte-h":!0}),f(N)!=="svelte-vo59ec"&&(N.innerHTML=We),he.forEach(o),c.forEach(o),me=l(e),V=r(e,"UL",{"data-svelte-h":!0}),f(V)!=="svelte-1p6h59i"&&(V.innerHTML=Pe),fe=l(e),g(S.$$.fragment,e),ue=l(e),F=r(e,"P",{}),H(F).forEach(o),this.h()},h(){A(i,"name","hf:doc:metadata"),A(i,"content",He),A(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){m(document.head,i),s(e,y,t),s(e,d,t),s(e,v,t),h(x,e,t),s(e,O,t),s(e,k,t),s(e,ee,t),s(e,j,t),s(e,te,t),s(e,C,t),s(e,oe,t),s(e,$,t),s(e,se,t),h(Z,e,t),s(e,ne,t),h(I,e,t),s(e,le,t),h(Q,e,t),s(e,ie,t),s(e,E,t),s(e,ae,t),h(U,e,t),s(e,re,t),h(w,e,t),s(e,pe,t),h(K,e,t),s(e,de,t),h(R,e,t),s(e,ce,t),s(e,p,t),h(W,p,null),m(p,_e),m(p,z),m(p,be),m(p,D),m(p,ye),m(p,X),m(p,ve),m(p,q),m(p,Ue),m(p,T),h(P,T,null),m(T,we),m(T,B),m(p,Te),m(p,J),h(G,J,null),m(J,Je),m(J,N),s(e,me,t),s(e,V,t),s(e,fe,t),h(S,e,t),s(e,ue,t),s(e,F,t),ge=!0},p(e,[t]){const c={};t&2&&(c.$$scope={dirty:t,ctx:e}),U.$set(c);const L={};t&2&&(L.$$scope={dirty:t,ctx:e}),w.$set(L)},i(e){ge||(M(x.$$.fragment,e),M(Z.$$.fragment,e),M(I.$$.fragment,e),M(Q.$$.fragment,e),M(U.$$.fragment,e),M(w.$$.fragment,e),M(K.$$.fragment,e),M(R.$$.fragment,e),M(W.$$.fragment,e),M(P.$$.fragment,e),M(G.$$.fragment,e),M(S.$$.fragment,e),ge=!0)},o(e){_(x.$$.fragment,e),_(Z.$$.fragment,e),_(I.$$.fragment,e),_(Q.$$.fragment,e),_(U.$$.fragment,e),_(w.$$.fragment,e),_(K.$$.fragment,e),_(R.$$.fragment,e),_(W.$$.fragment,e),_(P.$$.fragment,e),_(G.$$.fragment,e),_(S.$$.fragment,e),ge=!1},d(e){e&&(o(y),o(d),o(v),o(O),o(k),o(ee),o(j),o(te),o(C),o(oe),o($),o(se),o(ne),o(le),o(ie),o(E),o(ae),o(re),o(pe),o(de),o(ce),o(p),o(me),o(V),o(fe),o(ue),o(F)),o(i),b(x,e),b(Z,e),b(I,e),b(Q,e),b(U,e),b(w,e),b(K,e),b(R,e),b(W),b(P),b(G),b(S,e)}}}const He='{"title":"Kolors: Effective Training of Diffusion Model for Photorealistic Text-to-Image Synthesis","local":"kolors-effective-training-of-diffusion-model-for-photorealistic-text-to-image-synthesis","sections":[{"title":"Usage Example","local":"usage-example","sections":[{"title":"IP Adapter","local":"ip-adapter","sections":[],"depth":3}],"depth":2},{"title":"KolorsPipeline","local":"diffusers.KolorsPipeline","sections":[],"depth":2}],"depth":1}';function Ae(Y){return Ye(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class lt extends ze{constructor(i){super(),De(this,i,Ae,Fe,Le,{})}}export{lt as component};
