Buckets:
| import{s as vl,o as jl,n as dt}from"../chunks/scheduler.182ea377.js";import{S as Zl,i as kl,g as i,s,p as c,x as $,A as $l,h as a,f as n,c as o,j as J,q as m,m as p,y as x,k as M,v as b,a as l,r as h,d as u,t as f,u as y}from"../chunks/index.008d68e4.js";import{T as pt}from"../chunks/Tip.4f096367.js";import{I as Oe}from"../chunks/IconCopyLink.96bbb92b.js";import{C as w}from"../chunks/CodeBlock.5ed6eb7b.js";function xl(U){let r,g="This script is experimental, and it’s easy to overfit and run into issues like catastrophic forgetting. Try exploring different hyperparameters to get the best results on your dataset.";return{c(){r=i("p"),r.textContent=g},l(d){r=a(d,"P",{"data-svelte-h":!0}),p(r)!=="svelte-8jxpji"&&(r.textContent=g)},m(d,_){l(d,r,_)},p:dt,d(d){d&&n(r)}}}function Cl(U){let r,g='🤗 Accelerate is a library for helping you train on multiple GPUs/TPUs or with mixed-precision. It’ll automatically configure your training setup based on your hardware and environment. Take a look at the 🤗 Accelerate <a href="https://huggingface.co/docs/accelerate/quicktour" rel="nofollow">Quick tour</a> to learn more.';return{c(){r=i("p"),r.innerHTML=g},l(d){r=a(d,"P",{"data-svelte-h":!0}),p(r)!=="svelte-1qbiqsn"&&(r.innerHTML=g)},m(d,_){l(d,r,_)},p:dt,d(d){d&&n(r)}}}function Wl(U){let r,g="The following sections highlight parts of the training scripts that are important for understanding how to modify it, but it doesn’t cover every aspect of the scripts in detail. If you’re interested in learning more, feel free to read through the scripts and let us know if you have any questions or concerns.";return{c(){r=i("p"),r.textContent=g},l(d){r=a(d,"P",{"data-svelte-h":!0}),p(r)!=="svelte-18fk2c2"&&(r.textContent=g)},m(d,_){l(d,r,_)},p:dt,d(d){d&&n(r)}}}function Rl(U){let r,g="To monitor training progress with Weights & Biases, add the <code>--report_to=wandb</code> parameter to the training command. You’ll also need to add the <code>--validation_prompt</code> to the training command to keep track of results. This can be really useful for debugging the model and viewing intermediate results.";return{c(){r=i("p"),r.innerHTML=g},l(d){r=a(d,"P",{"data-svelte-h":!0}),p(r)!=="svelte-1sfnrue"&&(r.innerHTML=g)},m(d,_){l(d,r,_)},p:dt,d(d){d&&n(r)}}}function Il(U){let r,g="Feel free to replace <code>kandinsky-community/kandinsky-2-2-decoder</code> with your own trained decoder checkpoint!";return{c(){r=i("p"),r.innerHTML=g},l(d){r=a(d,"P",{"data-svelte-h":!0}),p(r)!=="svelte-kjbjgh"&&(r.innerHTML=g)},m(d,_){l(d,r,_)},p:dt,d(d){d&&n(r)}}}function Xl(U){let r,g,d,_,et,Q,vn,Se,Cn="Kandinsky 2.2",ct,C,mt,F,Wn="Kandinsky 2.2 is a multilingual text-to-image model capable of producing more photorealistic images. The model includes an image prior model for creating image embeddings from text prompts, and a decoder model that generates images based on the prior model’s embeddings. That’s why you’ll find two separate scripts in Diffusers for Kandinsky 2.2, one for training the prior model and one for training the decoder model. You can train both models separately, but to get the best results, you should train both the prior and decoder models.",ht,A,Rn='Depending on your GPU, you may need to enable <code>gradient_checkpointing</code> (⚠️ not supported for the prior model!), <code>mixed_precision</code>, and <code>gradient_accumulation_steps</code> to help fit the model into memory and to speedup training. You can reduce your memory-usage even more by enabling memory-efficient attention with <a href="../optimization/xformers">xFormers</a> (version <a href="https://github.com/huggingface/diffusers/issues/2234#issuecomment-1416931212" rel="nofollow">v0.0.16</a> fails for training on some GPUs so you may need to install a development version instead).',ut,E,In='This guide explores the <a href="https://github.com/huggingface/diffusers/blob/main/examples/kandinsky2_2/text_to_image/train_text_to_image_prior.py" rel="nofollow">train_text_to_image_prior.py</a> and the <a href="https://github.com/huggingface/diffusers/blob/main/examples/kandinsky2_2/text_to_image/train_text_to_image_decoder.py" rel="nofollow">train_text_to_image_decoder.py</a> scripts to help you become more familiar with it, and how you can adapt it for your own use-case.',ft,Y,Xn="Before running the scripts, make sure you install the library from source:",yt,L,Mt,S,Vn="Then navigate to the example folder containing the training script and install the required dependencies for the script you’re using:",bt,z,gt,W,wt,q,Gn="Initialize an 🤗 Accelerate environment:",_t,P,Jt,D,Bn="To setup a default 🤗 Accelerate environment without choosing any configurations:",Ut,K,Tt,O,Hn="Or if your environment doesn’t support an interactive shell, like a notebook, you can use:",vt,ee,jt,te,Nn='Lastly, if you want to train a model on your own dataset, take a look at the <a href="create_dataset">Create a dataset for training</a> guide to learn how to create a dataset that works with the training script.',Zt,R,kt,T,I,tt,ne,jn,ze,Qn="Script parameters",$t,le,Fn='The training scripts provides many parameters to help you customize your training run. All of the parameters and their descriptions are found in the <a href="https://github.com/huggingface/diffusers/blob/6e68c71503682c8693cb5b06a4da4911dfd655ee/examples/kandinsky2_2/text_to_image/train_text_to_image_prior.py#L190" rel="nofollow"><code>parse_args()</code></a> function. The training scripts provides default values for each parameter, such as the training batch size and learning rate, but you can also set your own values in the training command if you’d like.',xt,ie,An="For example, to speedup training with mixed precision using the fp16 format, add the <code>--mixed_precision</code> parameter to the training command:",Ct,ae,Wt,se,En='Most of the parameters are identical to the parameters in the <a href="text2image#script-parameters">Text-to-image</a> training guide, so let’s get straight to a walkthrough of the Kandinsky training scripts!',Rt,v,X,nt,oe,Zn,qe,Yn="Min-SNR weighting",It,re,Ln='The <a href="https://huggingface.co/papers/2303.09556" rel="nofollow">Min-SNR</a> weighting strategy can help with training by rebalancing the loss to achieve faster convergence. The training script supports predicting <code>epsilon</code> (noise) or <code>v_prediction</code>, but Min-SNR is compatible with both prediction types. This weighting strategy is only supported by PyTorch and is unavailable in the Flax training script.',Xt,pe,Sn="Add the <code>--snr_gamma</code> parameter and set it to the recommended value of 5.0:",Vt,de,Gt,j,V,lt,ce,kn,Pe,zn="Training script",Bt,me,qn='The training script is also similar to the <a href="text2image#training-script">Text-to-image</a> training guide, but it’s been modified to support training the prior and decoder models. This guide focuses on the code that is unique to the Kandinsky 2.2 training scripts.',Ht,he,Pn='The <a href="https://github.com/huggingface/diffusers/blob/6e68c71503682c8693cb5b06a4da4911dfd655ee/examples/kandinsky2_2/text_to_image/train_text_to_image_prior.py#L441" rel="nofollow"><code>main()</code></a> function contains the code for preparing the dataset and training the model.',Nt,ue,Dn="One of the main differences you’ll notice right away is that the training script also loads a <code>CLIPImageProcessor</code> - in addition to a scheduler and tokenizer - for preprocessing images and a <code>CLIPVisionModelWithProjection</code> model for encoding the images:",Qt,fe,Ft,ye,Kn='Kandinsky uses a <a href="/docs/diffusers/v0.25.0/ko/api/models/prior_transformer#diffusers.PriorTransformer">PriorTransformer</a> to generate the image embeddings, so you’ll want to setup the optimizer to learn the prior mode’s parameters.',At,Me,Et,be,On='Next, the input captions are tokenized, and images are <a href="https://github.com/huggingface/diffusers/blob/6e68c71503682c8693cb5b06a4da4911dfd655ee/examples/kandinsky2_2/text_to_image/train_text_to_image_prior.py#L632" rel="nofollow">preprocessed</a> by the <code>CLIPImageProcessor</code>:',Yt,ge,Lt,we,el='Finally, the <a href="https://github.com/huggingface/diffusers/blob/6e68c71503682c8693cb5b06a4da4911dfd655ee/examples/kandinsky2_2/text_to_image/train_text_to_image_prior.py#L718" rel="nofollow">training loop</a> converts the input images into latents, adds noise to the image embeddings, and makes a prediction:',St,_e,zt,Je,tl='If you want to learn more about how the training loop works, check out the <a href="../using-diffusers/write_own_pipeline">Understanding pipelines, models and schedulers</a> tutorial which breaks down the basic pattern of the denoising process.',qt,Ue,nl='The <a href="https://github.com/huggingface/diffusers/blob/6e68c71503682c8693cb5b06a4da4911dfd655ee/examples/kandinsky2_2/text_to_image/train_text_to_image_decoder.py#L440" rel="nofollow"><code>main()</code></a> function contains the code for preparing the dataset and training the model.',Pt,Te,ll='Unlike the prior model, the decoder initializes a <a href="/docs/diffusers/v0.25.0/ko/api/models/vq#diffusers.VQModel">VQModel</a> to decode the latents into images and it uses a <a href="/docs/diffusers/v0.25.0/ko/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>:',Dt,ve,Kt,je,il='Next, the script includes several image transforms and a <a href="https://github.com/huggingface/diffusers/blob/6e68c71503682c8693cb5b06a4da4911dfd655ee/examples/kandinsky2_2/text_to_image/train_text_to_image_decoder.py#L622" rel="nofollow">preprocessing</a> function for applying the transforms to the images and returning the pixel values:',Ot,Ze,en,ke,al='Lastly, the <a href="https://github.com/huggingface/diffusers/blob/6e68c71503682c8693cb5b06a4da4911dfd655ee/examples/kandinsky2_2/text_to_image/train_text_to_image_decoder.py#L706" rel="nofollow">training loop</a> handles converting the images to latents, adding noise, and predicting the noise residual.',tn,$e,sl='If you want to learn more about how the training loop works, check out the <a href="../using-diffusers/write_own_pipeline">Understanding pipelines, models and schedulers</a> tutorial which breaks down the basic pattern of the denoising process.',nn,xe,ln,Z,G,it,Ce,$n,De,ol="Launch the script",an,We,rl="Once you’ve made all your changes or you’re okay with the default configuration, you’re ready to launch the training script! 🚀",sn,Re,pl='You’ll train on the <a href="https://huggingface.co/datasets/lambdalabs/pokemon-blip-captions" rel="nofollow">Pokémon BLIP captions</a> dataset to generate your own Pokémon, but you can also create and train on your own dataset by following the <a href="create_dataset">Create a dataset for training</a> guide. Set the environment variable <code>DATASET_NAME</code> to the name of the dataset on the Hub or if you’re training on your own files, set the environment variable <code>TRAIN_DIR</code> to a path to your dataset.',on,Ie,dl="If you’re training on more than one GPU, add the <code>--multi_gpu</code> parameter to the <code>accelerate launch</code> command.",rn,B,pn,Xe,dn,Ve,cn,Ge,cl="Once training is finished, you can use your newly trained model for inference!",mn,Be,hn,H,un,He,fn,Ne,ml="For the decoder model, you can also perform inference from a saved checkpoint which can be useful for viewing intermediate results. In this case, load the checkpoint into the UNet:",yn,Qe,Mn,k,N,at,Fe,xn,Ke,hl="Next steps",bn,Ae,ul="Congratulations on training a Kandinsky 2.2 model! To learn more about how to use your new model, the following guides may be helpful:",gn,Ee,fl='<li>Read the <a href="../using-diffusers/kandinsky">Kandinsky</a> guide to learn how to use it for a variety of different tasks (text-to-image, image-to-image, inpainting, interpolation), and how it can be combined with a ControlNet.</li> <li>Check out the <a href="dreambooth">DreamBooth</a> and <a href="lora">LoRA</a> training guides to learn how to train a personalized Kandinsky model with just a few example images. These two training techniques can even be combined!</li>',wn;return Q=new Oe({}),C=new pt({props:{warning:!0,$$slots:{default:[xl]},$$scope:{ctx:U}}}),L=new w({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC4=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers | |
| <span class="hljs-built_in">cd</span> diffusers | |
| pip install .`}}),z=new w({props:{code:"Y2QlMjBleGFtcGxlcyUyRmthbmRpbnNreTJfMiUyRnRleHRfdG9faW1hZ2UlMEFwaXAlMjBpbnN0YWxsJTIwLXIlMjByZXF1aXJlbWVudHMudHh0",highlighted:`<span class="hljs-built_in">cd</span> examples/kandinsky2_2/text_to_image | |
| pip install -r requirements.txt`}}),W=new pt({props:{$$slots:{default:[Cl]},$$scope:{ctx:U}}}),P=new w({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config"}}),K=new w({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default"}}),ee=new w({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjB3cml0ZV9iYXNpY19jb25maWclMEElMEF3cml0ZV9iYXNpY19jb25maWcoKQ==",highlighted:`from accelerate.utils import write_basic_config | |
| write_basic_config()`}}),R=new pt({props:{$$slots:{default:[Wl]},$$scope:{ctx:U}}}),ne=new Oe({}),ae=new w({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX3RleHRfdG9faW1hZ2VfcHJpb3IucHklMjAlNUMlMEElMjAlMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjI=",highlighted:`accelerate launch train_text_to_image_prior.py \\ | |
| --mixed_precision=<span class="hljs-string">"fp16"</span>`}}),oe=new Oe({}),de=new w({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluX3RleHRfdG9faW1hZ2VfcHJpb3IucHklMjAlNUMlMEElMjAlMjAtLXNucl9nYW1tYSUzRDUuMA==",highlighted:`accelerate launch train_text_to_image_prior.py \\ | |
| --snr_gamma=5.0`}}),ce=new Oe({}),fe=new w({props:{code:"bm9pc2Vfc2NoZWR1bGVyJTIwJTNEJTIwRERQTVNjaGVkdWxlcihiZXRhX3NjaGVkdWxlJTNEJTIyc3F1YXJlZGNvc19jYXBfdjIlMjIlMkMlMjBwcmVkaWN0aW9uX3R5cGUlM0QlMjJzYW1wbGUlMjIpJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQ0xJUEltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBhcmdzLnByZXRyYWluZWRfcHJpb3JfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIyaW1hZ2VfcHJvY2Vzc29yJTIyJTBBKSUwQXRva2VuaXplciUyMCUzRCUyMENMSVBUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKGFyZ3MucHJldHJhaW5lZF9wcmlvcl9tb2RlbF9uYW1lX29yX3BhdGglMkMlMjBzdWJmb2xkZXIlM0QlMjJ0b2tlbml6ZXIlMjIpJTBBJTBBd2l0aCUyMENvbnRleHRNYW5hZ2VycyhkZWVwc3BlZWRfemVyb19pbml0X2Rpc2FibGVkX2NvbnRleHRfbWFuYWdlcigpKSUzQSUwQSUyMCUyMCUyMCUyMGltYWdlX2VuY29kZXIlMjAlM0QlMjBDTElQVmlzaW9uTW9kZWxXaXRoUHJvamVjdGlvbi5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXJncy5wcmV0cmFpbmVkX3ByaW9yX21vZGVsX25hbWVfb3JfcGF0aCUyQyUyMHN1YmZvbGRlciUzRCUyMmltYWdlX2VuY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHdlaWdodF9kdHlwZSUwQSUyMCUyMCUyMCUyMCkuZXZhbCgpJTBBJTIwJTIwJTIwJTIwdGV4dF9lbmNvZGVyJTIwJTNEJTIwQ0xJUFRleHRNb2RlbFdpdGhQcm9qZWN0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBhcmdzLnByZXRyYWluZWRfcHJpb3JfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIydGV4dF9lbmNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R3ZWlnaHRfZHR5cGUlMEElMjAlMjAlMjAlMjApLmV2YWwoKQ==",highlighted:`noise_scheduler = DDPMScheduler(beta_schedule=<span class="hljs-string">"squaredcos_cap_v2"</span>, prediction_type=<span class="hljs-string">"sample"</span>) | |
| image_processor = CLIPImageProcessor.from_pretrained( | |
| args.pretrained_prior_model_name_or_path, subfolder=<span class="hljs-string">"image_processor"</span> | |
| ) | |
| tokenizer = CLIPTokenizer.from_pretrained(args.pretrained_prior_model_name_or_path, subfolder=<span class="hljs-string">"tokenizer"</span>) | |
| <span class="hljs-keyword">with</span> ContextManagers(deepspeed_zero_init_disabled_context_manager()): | |
| image_encoder = CLIPVisionModelWithProjection.from_pretrained( | |
| args.pretrained_prior_model_name_or_path, subfolder=<span class="hljs-string">"image_encoder"</span>, torch_dtype=weight_dtype | |
| ).<span class="hljs-built_in">eval</span>() | |
| text_encoder = CLIPTextModelWithProjection.from_pretrained( | |
| args.pretrained_prior_model_name_or_path, subfolder=<span class="hljs-string">"text_encoder"</span>, torch_dtype=weight_dtype | |
| ).<span class="hljs-built_in">eval</span>()`}}),Me=new w({props:{code:"cHJpb3IlMjAlM0QlMjBQcmlvclRyYW5zZm9ybWVyLmZyb21fcHJldHJhaW5lZChhcmdzLnByZXRyYWluZWRfcHJpb3JfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIycHJpb3IlMjIpJTBBcHJpb3IudHJhaW4oKSUwQW9wdGltaXplciUyMCUzRCUyMG9wdGltaXplcl9jbHMoJTBBJTIwJTIwJTIwJTIwcHJpb3IucGFyYW1ldGVycygpJTJDJTBBJTIwJTIwJTIwJTIwbHIlM0RhcmdzLmxlYXJuaW5nX3JhdGUlMkMlMEElMjAlMjAlMjAlMjBiZXRhcyUzRChhcmdzLmFkYW1fYmV0YTElMkMlMjBhcmdzLmFkYW1fYmV0YTIpJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X2RlY2F5JTNEYXJncy5hZGFtX3dlaWdodF9kZWNheSUyQyUwQSUyMCUyMCUyMCUyMGVwcyUzRGFyZ3MuYWRhbV9lcHNpbG9uJTJDJTBBKQ==",highlighted:`prior = PriorTransformer.from_pretrained(args.pretrained_prior_model_name_or_path, subfolder=<span class="hljs-string">"prior"</span>) | |
| prior.train() | |
| optimizer = optimizer_cls( | |
| prior.parameters(), | |
| lr=args.learning_rate, | |
| betas=(args.adam_beta1, args.adam_beta2), | |
| weight_decay=args.adam_weight_decay, | |
| eps=args.adam_epsilon, | |
| )`}}),ge=new w({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc190cmFpbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjAlNUJpbWFnZS5jb252ZXJ0KCUyMlJHQiUyMiklMjBmb3IlMjBpbWFnZSUyMGluJTIwZXhhbXBsZXMlNUJpbWFnZV9jb2x1bW4lNUQlNUQlMEElMjAlMjAlMjAlMjBleGFtcGxlcyU1QiUyMmNsaXBfcGl4ZWxfdmFsdWVzJTIyJTVEJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnBpeGVsX3ZhbHVlcyUwQSUyMCUyMCUyMCUyMGV4YW1wbGVzJTVCJTIydGV4dF9pbnB1dF9pZHMlMjIlNUQlMkMlMjBleGFtcGxlcyU1QiUyMnRleHRfbWFzayUyMiU1RCUyMCUzRCUyMHRva2VuaXplX2NhcHRpb25zKGV4YW1wbGVzKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGV4YW1wbGVz",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_train</span>(<span class="hljs-params">examples</span>): | |
| images = [image.convert(<span class="hljs-string">"RGB"</span>) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> examples[image_column]] | |
| examples[<span class="hljs-string">"clip_pixel_values"</span>] = image_processor(images, return_tensors=<span class="hljs-string">"pt"</span>).pixel_values | |
| examples[<span class="hljs-string">"text_input_ids"</span>], examples[<span class="hljs-string">"text_mask"</span>] = tokenize_captions(examples) | |
| <span class="hljs-keyword">return</span> examples`}}),_e=new w({props:{code:"bW9kZWxfcHJlZCUyMCUzRCUyMHByaW9yKCUwQSUyMCUyMCUyMCUyMG5vaXN5X2xhdGVudHMlMkMlMEElMjAlMjAlMjAlMjB0aW1lc3RlcCUzRHRpbWVzdGVwcyUyQyUwQSUyMCUyMCUyMCUyMHByb2pfZW1iZWRkaW5nJTNEcHJvbXB0X2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMGVuY29kZXJfaGlkZGVuX3N0YXRlcyUzRHRleHRfZW5jb2Rlcl9oaWRkZW5fc3RhdGVzJTJDJTBBJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0R0ZXh0X21hc2slMkMlMEEpLnByZWRpY3RlZF9pbWFnZV9lbWJlZGRpbmc=",highlighted:`model_pred = prior( | |
| noisy_latents, | |
| timestep=timesteps, | |
| proj_embedding=prompt_embeds, | |
| encoder_hidden_states=text_encoder_hidden_states, | |
| attention_mask=text_mask, | |
| ).predicted_image_embedding`}}),ve=new w({props:{code:"d2l0aCUyMENvbnRleHRNYW5hZ2VycyhkZWVwc3BlZWRfemVyb19pbml0X2Rpc2FibGVkX2NvbnRleHRfbWFuYWdlcigpKSUzQSUwQSUyMCUyMCUyMCUyMHZhZSUyMCUzRCUyMFZRTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFyZ3MucHJldHJhaW5lZF9kZWNvZGVyX21vZGVsX25hbWVfb3JfcGF0aCUyQyUyMHN1YmZvbGRlciUzRCUyMm1vdnElMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHdlaWdodF9kdHlwZSUwQSUyMCUyMCUyMCUyMCkuZXZhbCgpJTBBJTIwJTIwJTIwJTIwaW1hZ2VfZW5jb2RlciUyMCUzRCUyMENMSVBWaXNpb25Nb2RlbFdpdGhQcm9qZWN0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBhcmdzLnByZXRyYWluZWRfcHJpb3JfbW9kZWxfbmFtZV9vcl9wYXRoJTJDJTIwc3ViZm9sZGVyJTNEJTIyaW1hZ2VfZW5jb2RlciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEd2VpZ2h0X2R0eXBlJTBBJTIwJTIwJTIwJTIwKS5ldmFsKCklMEF1bmV0JTIwJTNEJTIwVU5ldDJEQ29uZGl0aW9uTW9kZWwuZnJvbV9wcmV0cmFpbmVkKGFyZ3MucHJldHJhaW5lZF9kZWNvZGVyX21vZGVsX25hbWVfb3JfcGF0aCUyQyUyMHN1YmZvbGRlciUzRCUyMnVuZXQlMjIp",highlighted:`<span class="hljs-keyword">with</span> ContextManagers(deepspeed_zero_init_disabled_context_manager()): | |
| vae = VQModel.from_pretrained( | |
| args.pretrained_decoder_model_name_or_path, subfolder=<span class="hljs-string">"movq"</span>, torch_dtype=weight_dtype | |
| ).<span class="hljs-built_in">eval</span>() | |
| image_encoder = CLIPVisionModelWithProjection.from_pretrained( | |
| args.pretrained_prior_model_name_or_path, subfolder=<span class="hljs-string">"image_encoder"</span>, torch_dtype=weight_dtype | |
| ).<span class="hljs-built_in">eval</span>() | |
| unet = UNet2DConditionModel.from_pretrained(args.pretrained_decoder_model_name_or_path, subfolder=<span class="hljs-string">"unet"</span>)`}}),Ze=new w({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc190cmFpbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjAlNUJpbWFnZS5jb252ZXJ0KCUyMlJHQiUyMiklMjBmb3IlMjBpbWFnZSUyMGluJTIwZXhhbXBsZXMlNUJpbWFnZV9jb2x1bW4lNUQlNUQlMEElMjAlMjAlMjAlMjBleGFtcGxlcyU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1QnRyYWluX3RyYW5zZm9ybXMoaW1hZ2UpJTIwZm9yJTIwaW1hZ2UlMjBpbiUyMGltYWdlcyU1RCUwQSUyMCUyMCUyMCUyMGV4YW1wbGVzJTVCJTIyY2xpcF9waXhlbF92YWx1ZXMlMjIlNUQlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikucGl4ZWxfdmFsdWVzJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZXhhbXBsZXM=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_train</span>(<span class="hljs-params">examples</span>): | |
| images = [image.convert(<span class="hljs-string">"RGB"</span>) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> examples[image_column]] | |
| examples[<span class="hljs-string">"pixel_values"</span>] = [train_transforms(image) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> images] | |
| examples[<span class="hljs-string">"clip_pixel_values"</span>] = image_processor(images, return_tensors=<span class="hljs-string">"pt"</span>).pixel_values | |
| <span class="hljs-keyword">return</span> examples`}}),xe=new w({props:{code:"bW9kZWxfcHJlZCUyMCUzRCUyMHVuZXQobm9pc3lfbGF0ZW50cyUyQyUyMHRpbWVzdGVwcyUyQyUyME5vbmUlMkMlMjBhZGRlZF9jb25kX2t3YXJncyUzRGFkZGVkX2NvbmRfa3dhcmdzKS5zYW1wbGUlNUIlM0ElMkMlMjAlM0E0JTVE",highlighted:'model_pred = unet(noisy_latents, timesteps, <span class="hljs-literal">None</span>, added_cond_kwargs=added_cond_kwargs).sample[:, :<span class="hljs-number">4</span>]'}}),Ce=new Oe({}),B=new pt({props:{$$slots:{default:[Rl]},$$scope:{ctx:U}}}),Xe=new w({props:{code:"ZXhwb3J0JTIwREFUQVNFVF9OQU1FJTNEJTIybGFtYmRhbGFicyUyRnBva2Vtb24tYmxpcC1jYXB0aW9ucyUyMiUwQSUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjIlMjAlMjB0cmFpbl90ZXh0X3RvX2ltYWdlX3ByaW9yLnB5JTIwJTVDJTBBJTIwJTIwLS1kYXRhc2V0X25hbWUlM0QlMjREQVRBU0VUX05BTUUlMjAlNUMlMEElMjAlMjAtLXJlc29sdXRpb24lM0Q3NjglMjAlNUMlMEElMjAlMjAtLXRyYWluX2JhdGNoX3NpemUlM0QxJTIwJTVDJTBBJTIwJTIwLS1ncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTIwJTVDJTBBJTIwJTIwLS1tYXhfdHJhaW5fc3RlcHMlM0QxNTAwMCUyMCU1QyUwQSUyMCUyMC0tbGVhcm5pbmdfcmF0ZSUzRDFlLTA1JTIwJTVDJTBBJTIwJTIwLS1tYXhfZ3JhZF9ub3JtJTNEMSUyMCU1QyUwQSUyMCUyMC0tY2hlY2twb2ludHNfdG90YWxfbGltaXQlM0QzJTIwJTVDJTBBJTIwJTIwLS1scl9zY2hlZHVsZXIlM0QlMjJjb25zdGFudCUyMiUyMCU1QyUwQSUyMCUyMC0tbHJfd2FybXVwX3N0ZXBzJTNEMCUyMCU1QyUwQSUyMCUyMC0tdmFsaWRhdGlvbl9wcm9tcHRzJTNEJTIyQSUyMHJvYm90JTIwcG9rZW1vbiUyQyUyMDRrJTIwcGhvdG8lMjIlMjAlNUMlMEElMjAlMjAtLXJlcG9ydF90byUzRCUyMndhbmRiJTIyJTIwJTVDJTBBJTIwJTIwLS1wdXNoX3RvX2h1YiUyMCU1QyUwQSUyMCUyMC0tb3V0cHV0X2RpciUzRCUyMmthbmRpMi1wcmlvci1wb2tlbW9uLW1vZGVsJTIyJTIw",highlighted:`<span class="hljs-built_in">export</span> DATASET_NAME=<span class="hljs-string">"lambdalabs/pokemon-blip-captions"</span> | |
| accelerate launch --mixed_precision=<span class="hljs-string">"fp16"</span> train_text_to_image_prior.py \\ | |
| --dataset_name=<span class="hljs-variable">$DATASET_NAME</span> \\ | |
| --resolution=768 \\ | |
| --train_batch_size=1 \\ | |
| --gradient_accumulation_steps=4 \\ | |
| --max_train_steps=15000 \\ | |
| --learning_rate=1e-05 \\ | |
| --max_grad_norm=1 \\ | |
| --checkpoints_total_limit=3 \\ | |
| --lr_scheduler=<span class="hljs-string">"constant"</span> \\ | |
| --lr_warmup_steps=0 \\ | |
| --validation_prompts=<span class="hljs-string">"A robot pokemon, 4k photo"</span> \\ | |
| --report_to=<span class="hljs-string">"wandb"</span> \\ | |
| --push_to_hub \\ | |
| --output_dir=<span class="hljs-string">"kandi2-prior-pokemon-model"</span> `}}),Ve=new w({props:{code:"ZXhwb3J0JTIwREFUQVNFVF9OQU1FJTNEJTIybGFtYmRhbGFicyUyRnBva2Vtb24tYmxpcC1jYXB0aW9ucyUyMiUwQSUwQWFjY2VsZXJhdGUlMjBsYXVuY2glMjAtLW1peGVkX3ByZWNpc2lvbiUzRCUyMmZwMTYlMjIlMjAlMjB0cmFpbl90ZXh0X3RvX2ltYWdlX2RlY29kZXIucHklMjAlNUMlMEElMjAlMjAtLWRhdGFzZXRfbmFtZSUzRCUyNERBVEFTRVRfTkFNRSUyMCU1QyUwQSUyMCUyMC0tcmVzb2x1dGlvbiUzRDc2OCUyMCU1QyUwQSUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDElMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAlNUMlMEElMjAlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDE1MDAwJTIwJTVDJTBBJTIwJTIwLS1sZWFybmluZ19yYXRlJTNEMWUtMDUlMjAlNUMlMEElMjAlMjAtLW1heF9ncmFkX25vcm0lM0QxJTIwJTVDJTBBJTIwJTIwLS1jaGVja3BvaW50c190b3RhbF9saW1pdCUzRDMlMjAlNUMlMEElMjAlMjAtLWxyX3NjaGVkdWxlciUzRCUyMmNvbnN0YW50JTIyJTIwJTVDJTBBJTIwJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwLS12YWxpZGF0aW9uX3Byb21wdHMlM0QlMjJBJTIwcm9ib3QlMjBwb2tlbW9uJTJDJTIwNGslMjBwaG90byUyMiUyMCU1QyUwQSUyMCUyMC0tcmVwb3J0X3RvJTNEJTIyd2FuZGIlMjIlMjAlNUMlMEElMjAlMjAtLXB1c2hfdG9faHViJTIwJTVDJTBBJTIwJTIwLS1vdXRwdXRfZGlyJTNEJTIya2FuZGkyLWRlY29kZXItcG9rZW1vbi1tb2RlbCUyMiUyMA==",highlighted:`<span class="hljs-built_in">export</span> DATASET_NAME=<span class="hljs-string">"lambdalabs/pokemon-blip-captions"</span> | |
| accelerate launch --mixed_precision=<span class="hljs-string">"fp16"</span> train_text_to_image_decoder.py \\ | |
| --dataset_name=<span class="hljs-variable">$DATASET_NAME</span> \\ | |
| --resolution=768 \\ | |
| --train_batch_size=1 \\ | |
| --gradient_accumulation_steps=4 \\ | |
| --gradient_checkpointing \\ | |
| --max_train_steps=15000 \\ | |
| --learning_rate=1e-05 \\ | |
| --max_grad_norm=1 \\ | |
| --checkpoints_total_limit=3 \\ | |
| --lr_scheduler=<span class="hljs-string">"constant"</span> \\ | |
| --lr_warmup_steps=0 \\ | |
| --validation_prompts=<span class="hljs-string">"A robot pokemon, 4k photo"</span> \\ | |
| --report_to=<span class="hljs-string">"wandb"</span> \\ | |
| --push_to_hub \\ | |
| --output_dir=<span class="hljs-string">"kandi2-decoder-pokemon-model"</span> `}}),Be=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMkMlMjBEaWZmdXNpb25QaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQob3V0cHV0X2RpciUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwcmlvcl9jb21wb25lbnRzJTIwJTNEJTIwJTdCJTIycHJpb3JfJTIyJTIwJTJCJTIwayUzQSUyMHYlMjBmb3IlMjBrJTJDdiUyMGluJTIwcHJpb3JfcGlwZWxpbmUuY29tcG9uZW50cy5pdGVtcygpJTdEJTBBcGlwZWxpbmUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwKipwcmlvcl9jb21wb25lbnRzJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQSUwQXBpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEFwcm9tcHQlM0QlMjJBJTIwcm9ib3QlMjBwb2tlbW9uJTJDJTIwNGslMjBwaG90byUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image, DiffusionPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| prior_pipeline = DiffusionPipeline.from_pretrained(output_dir, torch_dtype=torch.float16) | |
| prior_components = {<span class="hljs-string">"prior_"</span> + k: v <span class="hljs-keyword">for</span> k,v <span class="hljs-keyword">in</span> prior_pipeline.components.items()} | |
| pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">"kandinsky-community/kandinsky-2-2-decoder"</span>, **prior_components, torch_dtype=torch.float16) | |
| pipe.enable_model_cpu_offload() | |
| prompt=<span class="hljs-string">"A robot pokemon, 4k photo"</span> | |
| image = pipeline(prompt=prompt, negative_prompt=negative_prompt).images[<span class="hljs-number">0</span>]`}}),H=new pt({props:{$$slots:{default:[Il]},$$scope:{ctx:U}}}),He=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIycGF0aCUyRnRvJTJGc2F2ZWQlMkZtb2RlbCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUzRCUyMkElMjByb2JvdCUyMHBva2Vtb24lMkMlMjA0ayUyMHBob3RvJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlM0Rwcm9tcHQpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image | |
| <span class="hljs-keyword">import</span> torch | |
| pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">"path/to/saved/model"</span>, torch_dtype=torch.float16) | |
| pipeline.enable_model_cpu_offload() | |
| prompt=<span class="hljs-string">"A robot pokemon, 4k photo"</span> | |
| image = pipeline(prompt=prompt).images[<span class="hljs-number">0</span>]`}}),Qe=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMkMlMjBVTmV0MkRDb25kaXRpb25Nb2RlbCUwQSUwQXVuZXQlMjAlM0QlMjBVTmV0MkRDb25kaXRpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIycGF0aCUyRnRvJTJGc2F2ZWQlMkZtb2RlbCUyMiUyMCUyQiUyMCUyMiUyRmNoZWNrcG9pbnQtJTNDTiUzRSUyRnVuZXQlMjIpJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdW5ldCUzRHVuZXQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUzRCUyMkElMjByb2JvdCUyMHBva2Vtb24lMkMlMjA0ayUyMHBob3RvJTIyKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image, UNet2DConditionModel | |
| unet = UNet2DConditionModel.from_pretrained(<span class="hljs-string">"path/to/saved/model"</span> + <span class="hljs-string">"/checkpoint-<N>/unet"</span>) | |
| pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">"kandinsky-community/kandinsky-2-2-decoder"</span>, unet=unet, torch_dtype=torch.float16) | |
| pipeline.enable_model_cpu_offload() | |
| image = pipeline(prompt=<span class="hljs-string">"A robot pokemon, 4k photo"</span>).images[<span class="hljs-number">0</span>]`}}),Fe=new Oe({}),{c(){r=i("meta"),g=s(),d=i("h1"),_=i("a"),et=i("span"),c(Q.$$.fragment),vn=s(),Se=i("span"),Se.textContent=Cn,ct=s(),c(C.$$.fragment),mt=s(),F=i("p"),F.textContent=Wn,ht=s(),A=i("p"),A.innerHTML=Rn,ut=s(),E=i("p"),E.innerHTML=In,ft=s(),Y=i("p"),Y.textContent=Xn,yt=s(),c(L.$$.fragment),Mt=s(),S=i("p"),S.textContent=Vn,bt=s(),c(z.$$.fragment),gt=s(),c(W.$$.fragment),wt=s(),q=i("p"),q.textContent=Gn,_t=s(),c(P.$$.fragment),Jt=s(),D=i("p"),D.textContent=Bn,Ut=s(),c(K.$$.fragment),Tt=s(),O=i("p"),O.textContent=Hn,vt=s(),c(ee.$$.fragment),jt=s(),te=i("p"),te.innerHTML=Nn,Zt=s(),c(R.$$.fragment),kt=s(),T=i("h2"),I=i("a"),tt=i("span"),c(ne.$$.fragment),jn=s(),ze=i("span"),ze.textContent=Qn,$t=s(),le=i("p"),le.innerHTML=Fn,xt=s(),ie=i("p"),ie.innerHTML=An,Ct=s(),c(ae.$$.fragment),Wt=s(),se=i("p"),se.innerHTML=En,Rt=s(),v=i("h3"),X=i("a"),nt=i("span"),c(oe.$$.fragment),Zn=s(),qe=i("span"),qe.textContent=Yn,It=s(),re=i("p"),re.innerHTML=Ln,Xt=s(),pe=i("p"),pe.innerHTML=Sn,Vt=s(),c(de.$$.fragment),Gt=s(),j=i("h2"),V=i("a"),lt=i("span"),c(ce.$$.fragment),kn=s(),Pe=i("span"),Pe.textContent=zn,Bt=s(),me=i("p"),me.innerHTML=qn,Ht=$(` | |
| <hfoptions id="script"> | |
| <hfoption id="prior model"> | |
| `),he=i("p"),he.innerHTML=Pn,Nt=s(),ue=i("p"),ue.innerHTML=Dn,Qt=s(),c(fe.$$.fragment),Ft=s(),ye=i("p"),ye.innerHTML=Kn,At=s(),c(Me.$$.fragment),Et=s(),be=i("p"),be.innerHTML=On,Yt=s(),c(ge.$$.fragment),Lt=s(),we=i("p"),we.innerHTML=el,St=s(),c(_e.$$.fragment),zt=s(),Je=i("p"),Je.innerHTML=tl,qt=$(` | |
| </hfoption> | |
| <hfoption id="decoder model"> | |
| `),Ue=i("p"),Ue.innerHTML=nl,Pt=s(),Te=i("p"),Te.innerHTML=ll,Dt=s(),c(ve.$$.fragment),Kt=s(),je=i("p"),je.innerHTML=il,Ot=s(),c(Ze.$$.fragment),en=s(),ke=i("p"),ke.innerHTML=al,tn=s(),$e=i("p"),$e.innerHTML=sl,nn=s(),c(xe.$$.fragment),ln=$(` | |
| </hfoption> | |
| </hfoptions> | |
| `),Z=i("h2"),G=i("a"),it=i("span"),c(Ce.$$.fragment),$n=s(),De=i("span"),De.textContent=ol,an=s(),We=i("p"),We.textContent=rl,sn=s(),Re=i("p"),Re.innerHTML=pl,on=s(),Ie=i("p"),Ie.innerHTML=dl,rn=s(),c(B.$$.fragment),pn=$(` | |
| <hfoptions id="training-inference"> | |
| <hfoption id="prior model"> | |
| `),c(Xe.$$.fragment),dn=$(` | |
| </hfoption> | |
| <hfoption id="decoder model"> | |
| `),c(Ve.$$.fragment),cn=$(` | |
| </hfoption> | |
| </hfoptions> | |
| `),Ge=i("p"),Ge.textContent=cl,mn=$(` | |
| <hfoptions id="training-inference"> | |
| <hfoption id="prior model"> | |
| `),c(Be.$$.fragment),hn=s(),c(H.$$.fragment),un=$(` | |
| </hfoption> | |
| <hfoption id="decoder model"> | |
| `),c(He.$$.fragment),fn=s(),Ne=i("p"),Ne.textContent=ml,yn=s(),c(Qe.$$.fragment),Mn=$(` | |
| </hfoption> | |
| </hfoptions> | |
| `),k=i("h2"),N=i("a"),at=i("span"),c(Fe.$$.fragment),xn=s(),Ke=i("span"),Ke.textContent=hl,bn=s(),Ae=i("p"),Ae.textContent=ul,gn=s(),Ee=i("ul"),Ee.innerHTML=fl,this.h()},l(e){const t=$l("svelte-1phssyn",document.head);r=a(t,"META",{name:!0,content:!0}),t.forEach(n),g=o(e),d=a(e,"H1",{class:!0});var Ye=J(d);_=a(Ye,"A",{id:!0,class:!0,href:!0});var st=J(_);et=a(st,"SPAN",{});var ot=J(et);m(Q.$$.fragment,ot),ot.forEach(n),st.forEach(n),vn=o(Ye),Se=a(Ye,"SPAN",{"data-svelte-h":!0}),p(Se)!=="svelte-12daj4v"&&(Se.textContent=Cn),Ye.forEach(n),ct=o(e),m(C.$$.fragment,e),mt=o(e),F=a(e,"P",{"data-svelte-h":!0}),p(F)!=="svelte-6gxptx"&&(F.textContent=Wn),ht=o(e),A=a(e,"P",{"data-svelte-h":!0}),p(A)!=="svelte-1qig94u"&&(A.innerHTML=Rn),ut=o(e),E=a(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-1l8tmhd"&&(E.innerHTML=In),ft=o(e),Y=a(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-if4ul"&&(Y.textContent=Xn),yt=o(e),m(L.$$.fragment,e),Mt=o(e),S=a(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-z4z0b9"&&(S.textContent=Vn),bt=o(e),m(z.$$.fragment,e),gt=o(e),m(W.$$.fragment,e),wt=o(e),q=a(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-60q53m"&&(q.textContent=Gn),_t=o(e),m(P.$$.fragment,e),Jt=o(e),D=a(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-di6juu"&&(D.textContent=Bn),Ut=o(e),m(K.$$.fragment,e),Tt=o(e),O=a(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-tsz4qp"&&(O.textContent=Hn),vt=o(e),m(ee.$$.fragment,e),jt=o(e),te=a(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-1fkfdql"&&(te.innerHTML=Nn),Zt=o(e),m(R.$$.fragment,e),kt=o(e),T=a(e,"H2",{class:!0});var Le=J(T);I=a(Le,"A",{id:!0,class:!0,href:!0});var rt=J(I);tt=a(rt,"SPAN",{});var yl=J(tt);m(ne.$$.fragment,yl),yl.forEach(n),rt.forEach(n),jn=o(Le),ze=a(Le,"SPAN",{"data-svelte-h":!0}),p(ze)!=="svelte-r00uw2"&&(ze.textContent=Qn),Le.forEach(n),$t=o(e),le=a(e,"P",{"data-svelte-h":!0}),p(le)!=="svelte-r2qipu"&&(le.innerHTML=Fn),xt=o(e),ie=a(e,"P",{"data-svelte-h":!0}),p(ie)!=="svelte-1r0bv1x"&&(ie.innerHTML=An),Ct=o(e),m(ae.$$.fragment,e),Wt=o(e),se=a(e,"P",{"data-svelte-h":!0}),p(se)!=="svelte-fx0sux"&&(se.innerHTML=En),Rt=o(e),v=a(e,"H3",{class:!0});var _n=J(v);X=a(_n,"A",{id:!0,class:!0,href:!0});var Ml=J(X);nt=a(Ml,"SPAN",{});var bl=J(nt);m(oe.$$.fragment,bl),bl.forEach(n),Ml.forEach(n),Zn=o(_n),qe=a(_n,"SPAN",{"data-svelte-h":!0}),p(qe)!=="svelte-ulysw7"&&(qe.textContent=Yn),_n.forEach(n),It=o(e),re=a(e,"P",{"data-svelte-h":!0}),p(re)!=="svelte-isitbv"&&(re.innerHTML=Ln),Xt=o(e),pe=a(e,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-tp3kp"&&(pe.innerHTML=Sn),Vt=o(e),m(de.$$.fragment,e),Gt=o(e),j=a(e,"H2",{class:!0});var Jn=J(j);V=a(Jn,"A",{id:!0,class:!0,href:!0});var gl=J(V);lt=a(gl,"SPAN",{});var wl=J(lt);m(ce.$$.fragment,wl),wl.forEach(n),gl.forEach(n),kn=o(Jn),Pe=a(Jn,"SPAN",{"data-svelte-h":!0}),p(Pe)!=="svelte-339bde"&&(Pe.textContent=zn),Jn.forEach(n),Bt=o(e),me=a(e,"P",{"data-svelte-h":!0}),p(me)!=="svelte-1c9upjb"&&(me.innerHTML=qn),Ht=x(e,` | |
| <hfoptions id="script"> | |
| <hfoption id="prior model"> | |
| `),he=a(e,"P",{"data-svelte-h":!0}),p(he)!=="svelte-1vaqpft"&&(he.innerHTML=Pn),Nt=o(e),ue=a(e,"P",{"data-svelte-h":!0}),p(ue)!=="svelte-1l5jset"&&(ue.innerHTML=Dn),Qt=o(e),m(fe.$$.fragment,e),Ft=o(e),ye=a(e,"P",{"data-svelte-h":!0}),p(ye)!=="svelte-1t1yiqt"&&(ye.innerHTML=Kn),At=o(e),m(Me.$$.fragment,e),Et=o(e),be=a(e,"P",{"data-svelte-h":!0}),p(be)!=="svelte-15vdhnd"&&(be.innerHTML=On),Yt=o(e),m(ge.$$.fragment,e),Lt=o(e),we=a(e,"P",{"data-svelte-h":!0}),p(we)!=="svelte-1t2oswx"&&(we.innerHTML=el),St=o(e),m(_e.$$.fragment,e),zt=o(e),Je=a(e,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-6gmbd2"&&(Je.innerHTML=tl),qt=x(e,` | |
| </hfoption> | |
| <hfoption id="decoder model"> | |
| `),Ue=a(e,"P",{"data-svelte-h":!0}),p(Ue)!=="svelte-1d8rtu6"&&(Ue.innerHTML=nl),Pt=o(e),Te=a(e,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-9nf50j"&&(Te.innerHTML=ll),Dt=o(e),m(ve.$$.fragment,e),Kt=o(e),je=a(e,"P",{"data-svelte-h":!0}),p(je)!=="svelte-tuk4pl"&&(je.innerHTML=il),Ot=o(e),m(Ze.$$.fragment,e),en=o(e),ke=a(e,"P",{"data-svelte-h":!0}),p(ke)!=="svelte-rweqyj"&&(ke.innerHTML=al),tn=o(e),$e=a(e,"P",{"data-svelte-h":!0}),p($e)!=="svelte-6gmbd2"&&($e.innerHTML=sl),nn=o(e),m(xe.$$.fragment,e),ln=x(e,` | |
| </hfoption> | |
| </hfoptions> | |
| `),Z=a(e,"H2",{class:!0});var Un=J(Z);G=a(Un,"A",{id:!0,class:!0,href:!0});var _l=J(G);it=a(_l,"SPAN",{});var Jl=J(it);m(Ce.$$.fragment,Jl),Jl.forEach(n),_l.forEach(n),$n=o(Un),De=a(Un,"SPAN",{"data-svelte-h":!0}),p(De)!=="svelte-zp6p5k"&&(De.textContent=ol),Un.forEach(n),an=o(e),We=a(e,"P",{"data-svelte-h":!0}),p(We)!=="svelte-9dei1q"&&(We.textContent=rl),sn=o(e),Re=a(e,"P",{"data-svelte-h":!0}),p(Re)!=="svelte-cqb643"&&(Re.innerHTML=pl),on=o(e),Ie=a(e,"P",{"data-svelte-h":!0}),p(Ie)!=="svelte-mj0rx7"&&(Ie.innerHTML=dl),rn=o(e),m(B.$$.fragment,e),pn=x(e,` | |
| <hfoptions id="training-inference"> | |
| <hfoption id="prior model"> | |
| `),m(Xe.$$.fragment,e),dn=x(e,` | |
| </hfoption> | |
| <hfoption id="decoder model"> | |
| `),m(Ve.$$.fragment,e),cn=x(e,` | |
| </hfoption> | |
| </hfoptions> | |
| `),Ge=a(e,"P",{"data-svelte-h":!0}),p(Ge)!=="svelte-5prdlk"&&(Ge.textContent=cl),mn=x(e,` | |
| <hfoptions id="training-inference"> | |
| <hfoption id="prior model"> | |
| `),m(Be.$$.fragment,e),hn=o(e),m(H.$$.fragment,e),un=x(e,` | |
| </hfoption> | |
| <hfoption id="decoder model"> | |
| `),m(He.$$.fragment,e),fn=o(e),Ne=a(e,"P",{"data-svelte-h":!0}),p(Ne)!=="svelte-1xieqd5"&&(Ne.textContent=ml),yn=o(e),m(Qe.$$.fragment,e),Mn=x(e,` | |
| </hfoption> | |
| </hfoptions> | |
| `),k=a(e,"H2",{class:!0});var Tn=J(k);N=a(Tn,"A",{id:!0,class:!0,href:!0});var Ul=J(N);at=a(Ul,"SPAN",{});var Tl=J(at);m(Fe.$$.fragment,Tl),Tl.forEach(n),Ul.forEach(n),xn=o(Tn),Ke=a(Tn,"SPAN",{"data-svelte-h":!0}),p(Ke)!=="svelte-pr7lub"&&(Ke.textContent=hl),Tn.forEach(n),bn=o(e),Ae=a(e,"P",{"data-svelte-h":!0}),p(Ae)!=="svelte-135a8e3"&&(Ae.textContent=ul),gn=o(e),Ee=a(e,"UL",{"data-svelte-h":!0}),p(Ee)!=="svelte-1mj75la"&&(Ee.innerHTML=fl),this.h()},h(){M(r,"name","hf:doc:metadata"),M(r,"content",JSON.stringify(Vl)),M(_,"id","kandinsky-22"),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"),M(_,"href","#kandinsky-22"),M(d,"class","relative group"),M(I,"id","script-parameters"),M(I,"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"),M(I,"href","#script-parameters"),M(T,"class","relative group"),M(X,"id","minsnr-weighting"),M(X,"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"),M(X,"href","#minsnr-weighting"),M(v,"class","relative group"),M(V,"id","training-script"),M(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"),M(V,"href","#training-script"),M(j,"class","relative group"),M(G,"id","launch-the-script"),M(G,"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"),M(G,"href","#launch-the-script"),M(Z,"class","relative group"),M(N,"id","next-steps"),M(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"),M(N,"href","#next-steps"),M(k,"class","relative group")},m(e,t){b(document.head,r),l(e,g,t),l(e,d,t),b(d,_),b(_,et),h(Q,et,null),b(d,vn),b(d,Se),l(e,ct,t),h(C,e,t),l(e,mt,t),l(e,F,t),l(e,ht,t),l(e,A,t),l(e,ut,t),l(e,E,t),l(e,ft,t),l(e,Y,t),l(e,yt,t),h(L,e,t),l(e,Mt,t),l(e,S,t),l(e,bt,t),h(z,e,t),l(e,gt,t),h(W,e,t),l(e,wt,t),l(e,q,t),l(e,_t,t),h(P,e,t),l(e,Jt,t),l(e,D,t),l(e,Ut,t),h(K,e,t),l(e,Tt,t),l(e,O,t),l(e,vt,t),h(ee,e,t),l(e,jt,t),l(e,te,t),l(e,Zt,t),h(R,e,t),l(e,kt,t),l(e,T,t),b(T,I),b(I,tt),h(ne,tt,null),b(T,jn),b(T,ze),l(e,$t,t),l(e,le,t),l(e,xt,t),l(e,ie,t),l(e,Ct,t),h(ae,e,t),l(e,Wt,t),l(e,se,t),l(e,Rt,t),l(e,v,t),b(v,X),b(X,nt),h(oe,nt,null),b(v,Zn),b(v,qe),l(e,It,t),l(e,re,t),l(e,Xt,t),l(e,pe,t),l(e,Vt,t),h(de,e,t),l(e,Gt,t),l(e,j,t),b(j,V),b(V,lt),h(ce,lt,null),b(j,kn),b(j,Pe),l(e,Bt,t),l(e,me,t),l(e,Ht,t),l(e,he,t),l(e,Nt,t),l(e,ue,t),l(e,Qt,t),h(fe,e,t),l(e,Ft,t),l(e,ye,t),l(e,At,t),h(Me,e,t),l(e,Et,t),l(e,be,t),l(e,Yt,t),h(ge,e,t),l(e,Lt,t),l(e,we,t),l(e,St,t),h(_e,e,t),l(e,zt,t),l(e,Je,t),l(e,qt,t),l(e,Ue,t),l(e,Pt,t),l(e,Te,t),l(e,Dt,t),h(ve,e,t),l(e,Kt,t),l(e,je,t),l(e,Ot,t),h(Ze,e,t),l(e,en,t),l(e,ke,t),l(e,tn,t),l(e,$e,t),l(e,nn,t),h(xe,e,t),l(e,ln,t),l(e,Z,t),b(Z,G),b(G,it),h(Ce,it,null),b(Z,$n),b(Z,De),l(e,an,t),l(e,We,t),l(e,sn,t),l(e,Re,t),l(e,on,t),l(e,Ie,t),l(e,rn,t),h(B,e,t),l(e,pn,t),h(Xe,e,t),l(e,dn,t),h(Ve,e,t),l(e,cn,t),l(e,Ge,t),l(e,mn,t),h(Be,e,t),l(e,hn,t),h(H,e,t),l(e,un,t),h(He,e,t),l(e,fn,t),l(e,Ne,t),l(e,yn,t),h(Qe,e,t),l(e,Mn,t),l(e,k,t),b(k,N),b(N,at),h(Fe,at,null),b(k,xn),b(k,Ke),l(e,bn,t),l(e,Ae,t),l(e,gn,t),l(e,Ee,t),wn=!0},p(e,[t]){const Ye={};t&2&&(Ye.$$scope={dirty:t,ctx:e}),C.$set(Ye);const st={};t&2&&(st.$$scope={dirty:t,ctx:e}),W.$set(st);const ot={};t&2&&(ot.$$scope={dirty:t,ctx:e}),R.$set(ot);const Le={};t&2&&(Le.$$scope={dirty:t,ctx:e}),B.$set(Le);const rt={};t&2&&(rt.$$scope={dirty:t,ctx:e}),H.$set(rt)},i(e){wn||(u(Q.$$.fragment,e),u(C.$$.fragment,e),u(L.$$.fragment,e),u(z.$$.fragment,e),u(W.$$.fragment,e),u(P.$$.fragment,e),u(K.$$.fragment,e),u(ee.$$.fragment,e),u(R.$$.fragment,e),u(ne.$$.fragment,e),u(ae.$$.fragment,e),u(oe.$$.fragment,e),u(de.$$.fragment,e),u(ce.$$.fragment,e),u(fe.$$.fragment,e),u(Me.$$.fragment,e),u(ge.$$.fragment,e),u(_e.$$.fragment,e),u(ve.$$.fragment,e),u(Ze.$$.fragment,e),u(xe.$$.fragment,e),u(Ce.$$.fragment,e),u(B.$$.fragment,e),u(Xe.$$.fragment,e),u(Ve.$$.fragment,e),u(Be.$$.fragment,e),u(H.$$.fragment,e),u(He.$$.fragment,e),u(Qe.$$.fragment,e),u(Fe.$$.fragment,e),wn=!0)},o(e){f(Q.$$.fragment,e),f(C.$$.fragment,e),f(L.$$.fragment,e),f(z.$$.fragment,e),f(W.$$.fragment,e),f(P.$$.fragment,e),f(K.$$.fragment,e),f(ee.$$.fragment,e),f(R.$$.fragment,e),f(ne.$$.fragment,e),f(ae.$$.fragment,e),f(oe.$$.fragment,e),f(de.$$.fragment,e),f(ce.$$.fragment,e),f(fe.$$.fragment,e),f(Me.$$.fragment,e),f(ge.$$.fragment,e),f(_e.$$.fragment,e),f(ve.$$.fragment,e),f(Ze.$$.fragment,e),f(xe.$$.fragment,e),f(Ce.$$.fragment,e),f(B.$$.fragment,e),f(Xe.$$.fragment,e),f(Ve.$$.fragment,e),f(Be.$$.fragment,e),f(H.$$.fragment,e),f(He.$$.fragment,e),f(Qe.$$.fragment,e),f(Fe.$$.fragment,e),wn=!1},d(e){e&&(n(g),n(d),n(ct),n(mt),n(F),n(ht),n(A),n(ut),n(E),n(ft),n(Y),n(yt),n(Mt),n(S),n(bt),n(gt),n(wt),n(q),n(_t),n(Jt),n(D),n(Ut),n(Tt),n(O),n(vt),n(jt),n(te),n(Zt),n(kt),n(T),n($t),n(le),n(xt),n(ie),n(Ct),n(Wt),n(se),n(Rt),n(v),n(It),n(re),n(Xt),n(pe),n(Vt),n(Gt),n(j),n(Bt),n(me),n(Ht),n(he),n(Nt),n(ue),n(Qt),n(Ft),n(ye),n(At),n(Et),n(be),n(Yt),n(Lt),n(we),n(St),n(zt),n(Je),n(qt),n(Ue),n(Pt),n(Te),n(Dt),n(Kt),n(je),n(Ot),n(en),n(ke),n(tn),n($e),n(nn),n(ln),n(Z),n(an),n(We),n(sn),n(Re),n(on),n(Ie),n(rn),n(pn),n(dn),n(cn),n(Ge),n(mn),n(hn),n(un),n(fn),n(Ne),n(yn),n(Mn),n(k),n(bn),n(Ae),n(gn),n(Ee)),n(r),y(Q),y(C,e),y(L,e),y(z,e),y(W,e),y(P,e),y(K,e),y(ee,e),y(R,e),y(ne),y(ae,e),y(oe),y(de,e),y(ce),y(fe,e),y(Me,e),y(ge,e),y(_e,e),y(ve,e),y(Ze,e),y(xe,e),y(Ce),y(B,e),y(Xe,e),y(Ve,e),y(Be,e),y(H,e),y(He,e),y(Qe,e),y(Fe)}}}const Vl={local:"kandinsky-22",sections:[{local:"script-parameters",sections:[{local:"minsnr-weighting",title:"Min-SNR weighting"}],title:"Script parameters"},{local:"training-script",title:"Training script"},{local:"launch-the-script",title:"Launch the script"},{local:"next-steps",title:"Next steps"}],title:"Kandinsky 2.2"};function Gl(U){return jl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Al extends Zl{constructor(r){super(),kl(this,r,Gl,Xl,vl,{})}}export{Al as component}; | |
Xet Storage Details
- Size:
- 45.4 kB
- Xet hash:
- 7af0917f45d9d73791501250b6ba1864066ad10ae9e2a1a67daa7cd70e6f6248
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.