Buckets:
| import"../chunks/DsnmJJEf.js";import{i as ce,h as le,C as ue,H as n,D as o,E as fe,s as ge,a as k}from"../chunks/CmJXCtRL.js";import{p as pe,o as he,s as e,f,a as l,b as me,c as a,d as u,n as r,r as i}from"../chunks/DK803DsY.js";import{E as F}from"../chunks/Bu2vAape.js";const _e='{"title":"Guiders","local":"guiders","sections":[{"title":"BaseGuidance","local":"diffusers.BaseGuidance","sections":[],"depth":2},{"title":"ClassifierFreeGuidance","local":"diffusers.ClassifierFreeGuidance","sections":[],"depth":2},{"title":"ClassifierFreeZeroStarGuidance","local":"diffusers.ClassifierFreeZeroStarGuidance","sections":[],"depth":2},{"title":"SkipLayerGuidance","local":"diffusers.SkipLayerGuidance","sections":[],"depth":2},{"title":"SmoothedEnergyGuidance","local":"diffusers.SmoothedEnergyGuidance","sections":[],"depth":2},{"title":"PerturbedAttentionGuidance","local":"diffusers.PerturbedAttentionGuidance","sections":[],"depth":2},{"title":"AdaptiveProjectedGuidance","local":"diffusers.AdaptiveProjectedGuidance","sections":[],"depth":2},{"title":"AutoGuidance","local":"diffusers.AutoGuidance","sections":[],"depth":2},{"title":"TangentialClassifierFreeGuidance","local":"diffusers.TangentialClassifierFreeGuidance","sections":[],"depth":2}],"depth":1}';var be=u('<meta name="hf:doc:metadata"/>'),ve=u("<p>Example:</p> <!>",1),ye=u("<ol><li><strong>Original formulation</strong> (from paper):</li></ol> <!>",1),Ge=u('<ol start="2"><li><strong>Diffusers-native formulation</strong> (default, from Imagen paper):</li></ol> <!>',1),we=u(`<p></p> <!> <!> <p>Guiders are components in Modular Diffusers that control how the diffusion process is guided during generation. They implement various guidance techniques to improve generation quality and control.</p> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Base class providing the skeleton for implementing guidance techniques.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Cleans up the models for the guidance technique after a given batch of data. This method should be overridden | |
| in subclasses to implement specific model cleanup logic. It is useful for removing any hooks or other stateful | |
| modifications made during <code>prepare_models</code>.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Instantiate a guider from a pre-defined JSON configuration file in a local directory or Hub repository.</p> <blockquote class="tip"><p>> To use private or <a href="https://huggingface.co/docs/hub/models-gated#gated-models" rel="nofollow">gated models</a>, log-in | |
| with <code>hf > auth login</code>. You can also activate the special > <a href="https://huggingface.co/diffusers/installation.html#offline-mode" rel="nofollow">“offline-mode”</a> to use this method in a > | |
| firewalled environment.</p></blockquote></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Returns the current state of the guidance technique as a dictionary. The state variables will be included in | |
| the <strong>repr</strong> method. Returns: <code>dict[str, Any]</code>: A dictionary containing the current state variables including:</p> <ul><li>step: Current inference step</li> <li>num_inference_steps: Total number of inference steps</li> <li>timestep: Current timestep tensor</li> <li>count_prepared: Number of times prepare_models has been called</li> <li>enabled: Whether the guidance is enabled</li> <li>num_conditions: Number of conditions</li></ul></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Creates a copy of this guider instance, optionally with modified configuration parameters.</p> <!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Prepares the models for the guidance technique on a given batch of data. This method should be overridden in | |
| subclasses to implement specific model preparation logic.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Save a guider configuration object to a directory so that it can be reloaded using the <a href="/docs/diffusers/pr_13881/en/api/modular_diffusers/guiders#diffusers.BaseGuidance.from_pretrained">from_pretrained()</a> class method.</p></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Implements Classifier-Free Guidance (CFG) for diffusion models.</p> <p>Reference: <a href="https://huggingface.co/papers/2207.12598" rel="nofollow">https://huggingface.co/papers/2207.12598</a></p> <p>CFG improves generation quality and prompt adherence by jointly training models on both conditional and | |
| unconditional data, then combining predictions during inference. This allows trading off between quality (high | |
| guidance) and diversity (low guidance).</p> <p><strong>Two CFG Formulations:</strong></p> <!> Moves conditional predictions further from unconditional ones. <!> Moves unconditional predictions toward conditional ones, effectively suppressing negative features (e.g., "bad | |
| quality", "watermarks"). Equivalent in theory but more intuitive. <p>Use <code>use_original_formulation=True</code> to switch to the original formulation.</p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Classifier-free Zero<em>(CFG-Zero</em>): <a href="https://huggingface.co/papers/2503.18886" rel="nofollow">https://huggingface.co/papers/2503.18886</a></p> <p>This is an implementation of the Classifier-Free Zero* guidance technique, which is a variant of classifier-free | |
| guidance. It proposes zero initialization of the noise predictions for the first few steps of the diffusion | |
| process, and also introduces an optimal rescaling factor for the noise predictions, which can help in improving the | |
| quality of generated images.</p> <p>The authors of the paper suggest setting zero initialization in the first 4% of the inference steps.</p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Skip Layer Guidance (SLG): <a href="https://github.com/Stability-AI/sd3.5" rel="nofollow">https://github.com/Stability-AI/sd3.5</a></p> <p>Spatio-Temporal Guidance (STG): <a href="https://huggingface.co/papers/2411.18664" rel="nofollow">https://huggingface.co/papers/2411.18664</a></p> <p>SLG was introduced by StabilityAI for improving structure and anotomy coherence in generated images. It works by | |
| skipping the forward pass of specified transformer blocks during the denoising process on an additional conditional | |
| batch of data, apart from the conditional and unconditional batches already used in CFG | |
| ([~guiders.classifier_free_guidance.ClassifierFreeGuidance]), and then scaling and shifting the CFG predictions | |
| based on the difference between conditional without skipping and conditional with skipping predictions.</p> <p>The intution behind SLG can be thought of as moving the CFG predicted distribution estimates further away from | |
| worse versions of the conditional distribution estimates (because skipping layers is equivalent to using a worse | |
| version of the model for the conditional prediction).</p> <p>STG is an improvement and follow-up work combining ideas from SLG, PAG and similar techniques for improving | |
| generation quality in video diffusion models.</p> <p>Additional reading:</p> <ul><li><a href="https://huggingface.co/papers/2406.02507" rel="nofollow">Guiding a Diffusion Model with a Bad Version of Itself</a></li></ul> <p>The values for <code>skip_layer_guidance_scale</code>, <code>skip_layer_guidance_start</code>, and <code>skip_layer_guidance_stop</code> are | |
| defaulted to the recommendations by StabilityAI for Stable Diffusion 3.5 Medium.</p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Smoothed Energy Guidance (SEG): <a href="https://huggingface.co/papers/2408.00760" rel="nofollow">https://huggingface.co/papers/2408.00760</a></p> <p>SEG is only supported as an experimental prototype feature for now, so the implementation may be modified in the | |
| future without warning or guarantee of reproducibility. This implementation assumes:</p> <ul><li>Generated images are square (height == width)</li> <li>The model does not combine different modalities together (e.g., text and image latent streams are not combined | |
| together such as Flux)</li></ul></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Perturbed Attention Guidance (PAG): <a href="https://huggingface.co/papers/2403.17377" rel="nofollow">https://huggingface.co/papers/2403.17377</a></p> <p>The intution behind PAG can be thought of as moving the CFG predicted distribution estimates further away from | |
| worse versions of the conditional distribution estimates. PAG was one of the first techniques to introduce the idea | |
| of using a worse version of the trained model for better guiding itself in the denoising process. It perturbs the | |
| attention scores of the latent stream by replacing the score matrix with an identity matrix for selectively chosen | |
| layers.</p> <p>Additional reading:</p> <ul><li><a href="https://huggingface.co/papers/2406.02507" rel="nofollow">Guiding a Diffusion Model with a Bad Version of Itself</a></li></ul> <p>PAG is implemented with similar implementation to SkipLayerGuidance due to overlap in the configuration parameters | |
| and implementation details.</p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Adaptive Projected Guidance (APG): <a href="https://huggingface.co/papers/2410.02416" rel="nofollow">https://huggingface.co/papers/2410.02416</a></p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>AutoGuidance: <a href="https://huggingface.co/papers/2406.02507" rel="nofollow">https://huggingface.co/papers/2406.02507</a></p></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Tangential Classifier Free Guidance (TCFG): <a href="https://huggingface.co/papers/2503.18137" rel="nofollow">https://huggingface.co/papers/2503.18137</a></p></div> <!> <p></p>`,1);function ke(R,V){pe(V,!1),he(()=>{new URLSearchParams(window.location.search).get("fw")}),ce();var A=we();le("1gg64xk",t=>{var d=be();ge(d,"content",_e),l(t,d)});var L=e(f(A),2);ue(L,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var B=e(L,2);n(B,{title:"Guiders",local:"guiders",headingTag:"h1"});var j=e(B,4);n(j,{title:"BaseGuidance",local:"diffusers.BaseGuidance",headingTag:"h2"});var g=e(j,2),P=a(g);o(P,{name:"class diffusers.BaseGuidance",anchor:"diffusers.BaseGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/guider_utils.py#L38",parameters:[{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}]});var p=e(P,4),Y=a(p);o(Y,{name:"cleanup_models",anchor:"diffusers.BaseGuidance.cleanup_models",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/guider_utils.py#L160",parameters:[{name:"denoiser",val:": torch.nn.Module"}]}),r(2),i(p);var h=e(p,2),$=a(h);o($,{name:"from_pretrained",anchor:"diffusers.BaseGuidance.from_pretrained",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/guider_utils.py#L289",parameters:[{name:"pretrained_model_name_or_path",val:": str | os.PathLike | None = None"},{name:"subfolder",val:": str | None = None"},{name:"return_unused_kwargs",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.BaseGuidance.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) — | |
| Can be either:</p> | |
| <ul> | |
| <li>A string, the <em>model id</em> (for example <code>google/ddpm-celebahq-256</code>) of a pretrained model hosted on | |
| the Hub.</li> | |
| <li>A path to a <em>directory</em> (for example <code>./my_model_directory</code>) containing the guider configuration | |
| saved with <a href="/docs/diffusers/pr_13881/en/api/modular_diffusers/guiders#diffusers.BaseGuidance.save_pretrained">save_pretrained()</a>.</li> | |
| </ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.BaseGuidance.from_pretrained.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>) — | |
| The subfolder location of a model file within a larger model repository on the Hub or locally.`,name:"subfolder"},{anchor:"diffusers.BaseGuidance.from_pretrained.return_unused_kwargs",description:`<strong>return_unused_kwargs</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether kwargs that are not consumed by the Python class should be returned or not.`,name:"return_unused_kwargs"},{anchor:"diffusers.BaseGuidance.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>str | os.PathLike</code>, <em>optional</em>) — | |
| Path to a directory where a downloaded pretrained model configuration is cached if the standard cache | |
| is not used.`,name:"cache_dir"},{anchor:"diffusers.BaseGuidance.from_pretrained.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to force the (re-)download of the model weights and configuration files, overriding the | |
| cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.BaseGuidance.from_pretrained.proxies",description:`<strong>proxies</strong> (<code>dict[str, str]</code>, <em>optional</em>) — | |
| A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.BaseGuidance.from_pretrained.output_loading_info(bool,",description:`<strong>output_loading_info(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.`,name:"output_loading_info(bool,"},{anchor:"diffusers.BaseGuidance.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model | |
| won’t be downloaded from the Hub.`,name:"local_files_only(bool,"},{anchor:"diffusers.BaseGuidance.from_pretrained.token",description:`<strong>token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) — | |
| The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from | |
| <code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"token"},{anchor:"diffusers.BaseGuidance.from_pretrained.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"main"</code>) — | |
| The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier | |
| allowed by Git.`,name:"revision"}]}),r(4),i(h);var m=e(h,2),X=a(m);o(X,{name:"get_state",anchor:"diffusers.BaseGuidance.get_state",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/guider_utils.py#L106",parameters:[]}),r(4),i(m);var _=e(m,2),N=a(_);o(N,{name:"new",anchor:"diffusers.BaseGuidance.new",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/guider_utils.py#L69",parameters:[{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.BaseGuidance.new.*kwargs",description:`*<strong>*kwargs</strong> — Configuration parameters to override in the new instance. If no kwargs are provided, | |
| returns an exact copy with the same configuration.`,name:"*kwargs"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A new guider instance with the same (or updated) configuration.</p> | |
| `});var Q=e(N,4);F(Q,{anchor:"diffusers.BaseGuidance.new.example",children:(t,d)=>{var s=ve(),c=e(f(s),2);k(c,{code:"JTIzJTIwQ3JlYXRlJTIwYSUyMENGRyUyMGd1aWRlciUwQWd1aWRlciUyMCUzRCUyMENsYXNzaWZpZXJGcmVlR3VpZGFuY2UoZ3VpZGFuY2Vfc2NhbGUlM0QzLjUpJTBBJTBBJTIzJTIwQ3JlYXRlJTIwYW4lMjBleGFjdCUyMGNvcHklMEFzYW1lX2d1aWRlciUyMCUzRCUyMGd1aWRlci5uZXcoKSUwQSUwQSUyMyUyMENyZWF0ZSUyMGElMjBjb3B5JTIwd2l0aCUyMGRpZmZlcmVudCUyMHN0YXJ0JTIwc3RlcCUyQyUyMGtlZXBpbmclMjBvdGhlciUyMGNvbmZpZyUyMHRoZSUyMHNhbWUlMEFuZXdfZ3VpZGVyJTIwJTNEJTIwZ3VpZGVyLm5ldyhndWlkYW5jZV9zY2FsZSUzRDUp",highlighted:`<span class="hljs-comment"># Create a CFG guider</span> | |
| guider = ClassifierFreeGuidance(guidance_scale=<span class="hljs-number">3.5</span>) | |
| <span class="hljs-comment"># Create an exact copy</span> | |
| same_guider = guider.new() | |
| <span class="hljs-comment"># Create a copy with different start step, keeping other config the same</span> | |
| new_guider = guider.new(guidance_scale=<span class="hljs-number">5</span>)`,lang:"python",wrap:!1}),l(t,s)},$$slots:{default:!0}}),i(_);var b=e(_,2),O=a(b);o(O,{name:"prepare_models",anchor:"diffusers.BaseGuidance.prepare_models",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/guider_utils.py#L153",parameters:[{name:"denoiser",val:": torch.nn.Module"}]}),r(2),i(b);var I=e(b,2),K=a(I);o(K,{name:"save_pretrained",anchor:"diffusers.BaseGuidance.save_pretrained",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/guider_utils.py#L350",parameters:[{name:"save_directory",val:": str | os.PathLike"},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.BaseGuidance.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) — | |
| Directory where the configuration JSON file will be saved (will be created if it does not exist).`,name:"save_directory"},{anchor:"diffusers.BaseGuidance.save_pretrained.push_to_hub",description:`<strong>push_to_hub</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to push your model to the Hugging Face Hub after saving it. You can specify the | |
| repository you want to push to with <code>repo_id</code> (will default to the name of <code>save_directory</code> in your | |
| namespace).`,name:"push_to_hub"},{anchor:"diffusers.BaseGuidance.save_pretrained.kwargs",description:`<strong>kwargs</strong> (<code>dict[str, Any]</code>, <em>optional</em>) — | |
| Additional keyword arguments passed along to the <a href="/docs/diffusers/pr_13881/en/api/schedulers/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}]}),r(2),i(I),i(g);var M=e(g,2);n(M,{title:"ClassifierFreeGuidance",local:"diffusers.ClassifierFreeGuidance",headingTag:"h2"});var v=e(M,2),E=a(v);o(E,{name:"class diffusers.ClassifierFreeGuidance",anchor:"diffusers.ClassifierFreeGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/classifier_free_guidance.py#L30",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ClassifierFreeGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| CFG scale applied by this guider during post-processing. Higher values = stronger prompt conditioning but | |
| may reduce quality. Typical range: 1.0-20.0.`,name:"guidance_scale"},{anchor:"diffusers.ClassifierFreeGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| Rescaling factor to prevent overexposure from high guidance scales. Based on <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise | |
| Schedules and Sample Steps are Flawed</a>. Range: 0.0 (no rescaling) | |
| to 1.0 (full rescaling).`,name:"guidance_rescale"},{anchor:"diffusers.ClassifierFreeGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| If <code>True</code>, uses the original CFG formulation from the paper. If <code>False</code> (default), uses the | |
| diffusers-native formulation from the Imagen paper.`,name:"use_original_formulation"},{anchor:"diffusers.ClassifierFreeGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| Fraction of denoising steps (0.0-1.0) after which CFG starts. Use > 0.0 to disable CFG in early denoising | |
| steps.`,name:"start"},{anchor:"diffusers.ClassifierFreeGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| Fraction of denoising steps (0.0-1.0) after which CFG stops. Use < 1.0 to disable CFG in late denoising | |
| steps.`,name:"stop"},{anchor:"diffusers.ClassifierFreeGuidance.enabled",description:`<strong>enabled</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether CFG is enabled. Set to <code>False</code> to disable CFG entirely (uses only conditional predictions).`,name:"enabled"}]});var Z=e(E,10);F(Z,{anchor:"diffusers.ClassifierFreeGuidance.example",children:(t,d)=>{var s=ye(),c=e(f(s),2);k(c,{code:"eF9wcmVkJTIwJTNEJTIweF9jb25kJTIwJTJCJTIwZ3VpZGFuY2Vfc2NhbGUlMjAqJTIwKHhfY29uZCUyMC0lMjB4X3VuY29uZCk=",highlighted:'<span class="hljs-attr">x_pred</span> = x_cond + guidance_scale * (x_cond - x_uncond)',lang:"",wrap:!1}),l(t,s)},$$slots:{default:!0}});var ee=e(Z,2);F(ee,{anchor:"diffusers.ClassifierFreeGuidance.example-2",children:(t,d)=>{var s=Ge(),c=e(f(s),2);k(c,{code:"eF9wcmVkJTIwJTNEJTIweF91bmNvbmQlMjAlMkIlMjBndWlkYW5jZV9zY2FsZSUyMColMjAoeF9jb25kJTIwLSUyMHhfdW5jb25kKQ==",highlighted:'<span class="hljs-attr">x_pred</span> = x_uncond + guidance_scale * (x_cond - x_uncond)',lang:"",wrap:!1}),l(t,s)},$$slots:{default:!0}}),r(2),i(v);var q=e(v,2);n(q,{title:"ClassifierFreeZeroStarGuidance",local:"diffusers.ClassifierFreeZeroStarGuidance",headingTag:"h2"});var y=e(q,2),oe=a(y);o(oe,{name:"class diffusers.ClassifierFreeZeroStarGuidance",anchor:"diffusers.ClassifierFreeZeroStarGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/classifier_free_zero_star_guidance.py#L30",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"zero_init_steps",val:": int = 1"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ClassifierFreeZeroStarGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| The scale parameter for classifier-free guidance. Higher values result in stronger conditioning on the text | |
| prompt, while lower values allow for more freedom in generation. Higher values may lead to saturation and | |
| deterioration of image quality.`,name:"guidance_scale"},{anchor:"diffusers.ClassifierFreeZeroStarGuidance.zero_init_steps",description:`<strong>zero_init_steps</strong> (<code>int</code>, defaults to <code>1</code>) — | |
| The number of inference steps for which the noise predictions are zeroed out (see Section 4.2).`,name:"zero_init_steps"},{anchor:"diffusers.ClassifierFreeZeroStarGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix | |
| overexposure. Based on Section 3.4 from <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are | |
| Flawed</a>.`,name:"guidance_rescale"},{anchor:"diffusers.ClassifierFreeZeroStarGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the original formulation of classifier-free guidance as proposed in the paper. By default, | |
| we use the diffusers-native implementation that has been in the codebase for a long time. See | |
| [~guiders.classifier_free_guidance.ClassifierFreeGuidance] for more details.`,name:"use_original_formulation"},{anchor:"diffusers.ClassifierFreeZeroStarGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.01</code>) — | |
| The fraction of the total number of denoising steps after which guidance starts.`,name:"start"},{anchor:"diffusers.ClassifierFreeZeroStarGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>0.2</code>) — | |
| The fraction of the total number of denoising steps after which guidance stops.`,name:"stop"}]}),r(6),i(y);var U=e(y,2);n(U,{title:"SkipLayerGuidance",local:"diffusers.SkipLayerGuidance",headingTag:"h2"});var G=e(U,2),ae=a(G);o(ae,{name:"class diffusers.SkipLayerGuidance",anchor:"diffusers.SkipLayerGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/skip_layer_guidance.py#L32",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"skip_layer_guidance_scale",val:": float = 2.8"},{name:"skip_layer_guidance_start",val:": float = 0.01"},{name:"skip_layer_guidance_stop",val:": float = 0.2"},{name:"skip_layer_guidance_layers",val:": int | list[int] | None = None"},{name:"skip_layer_config",val:": LayerSkipConfig | list[LayerSkipConfig] | dict[str, Any] = None"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.SkipLayerGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| The scale parameter for classifier-free guidance. Higher values result in stronger conditioning on the text | |
| prompt, while lower values allow for more freedom in generation. Higher values may lead to saturation and | |
| deterioration of image quality.`,name:"guidance_scale"},{anchor:"diffusers.SkipLayerGuidance.skip_layer_guidance_scale",description:`<strong>skip_layer_guidance_scale</strong> (<code>float</code>, defaults to <code>2.8</code>) — | |
| The scale parameter for skip layer guidance. Anatomy and structure coherence may improve with higher | |
| values, but it may also lead to overexposure and saturation.`,name:"skip_layer_guidance_scale"},{anchor:"diffusers.SkipLayerGuidance.skip_layer_guidance_start",description:`<strong>skip_layer_guidance_start</strong> (<code>float</code>, defaults to <code>0.01</code>) — | |
| The fraction of the total number of denoising steps after which skip layer guidance starts.`,name:"skip_layer_guidance_start"},{anchor:"diffusers.SkipLayerGuidance.skip_layer_guidance_stop",description:`<strong>skip_layer_guidance_stop</strong> (<code>float</code>, defaults to <code>0.2</code>) — | |
| The fraction of the total number of denoising steps after which skip layer guidance stops.`,name:"skip_layer_guidance_stop"},{anchor:"diffusers.SkipLayerGuidance.skip_layer_guidance_layers",description:`<strong>skip_layer_guidance_layers</strong> (<code>int</code> or <code>list[int]</code>, <em>optional</em>) — | |
| The layer indices to apply skip layer guidance to. Can be a single integer or a list of integers. If not | |
| provided, <code>skip_layer_config</code> must be provided. The recommended values are <code>[7, 8, 9]</code> for Stable Diffusion | |
| 3.5 Medium.`,name:"skip_layer_guidance_layers"},{anchor:"diffusers.SkipLayerGuidance.skip_layer_config",description:`<strong>skip_layer_config</strong> (<code>LayerSkipConfig</code> or <code>list[LayerSkipConfig]</code>, <em>optional</em>) — | |
| The configuration for the skip layer guidance. Can be a single <code>LayerSkipConfig</code> or a list of | |
| <code>LayerSkipConfig</code>. If not provided, <code>skip_layer_guidance_layers</code> must be provided.`,name:"skip_layer_config"},{anchor:"diffusers.SkipLayerGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix | |
| overexposure. Based on Section 3.4 from <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are | |
| Flawed</a>.`,name:"guidance_rescale"},{anchor:"diffusers.SkipLayerGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the original formulation of classifier-free guidance as proposed in the paper. By default, | |
| we use the diffusers-native implementation that has been in the codebase for a long time. See | |
| [~guiders.classifier_free_guidance.ClassifierFreeGuidance] for more details.`,name:"use_original_formulation"},{anchor:"diffusers.SkipLayerGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.01</code>) — | |
| The fraction of the total number of denoising steps after which guidance starts.`,name:"start"},{anchor:"diffusers.SkipLayerGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>0.2</code>) — | |
| The fraction of the total number of denoising steps after which guidance stops.`,name:"stop"}]}),r(16),i(G);var D=e(G,2);n(D,{title:"SmoothedEnergyGuidance",local:"diffusers.SmoothedEnergyGuidance",headingTag:"h2"});var w=e(D,2),ie=a(w);o(ie,{name:"class diffusers.SmoothedEnergyGuidance",anchor:"diffusers.SmoothedEnergyGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/smoothed_energy_guidance.py#L32",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"seg_guidance_scale",val:": float = 2.8"},{name:"seg_blur_sigma",val:": float = 9999999.0"},{name:"seg_blur_threshold_inf",val:": float = 9999.0"},{name:"seg_guidance_start",val:": float = 0.0"},{name:"seg_guidance_stop",val:": float = 1.0"},{name:"seg_guidance_layers",val:": int | list[int] | None = None"},{name:"seg_guidance_config",val:": SmoothedEnergyGuidanceConfig | list[SmoothedEnergyGuidanceConfig] = None"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.SmoothedEnergyGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| The scale parameter for classifier-free guidance. Higher values result in stronger conditioning on the text | |
| prompt, while lower values allow for more freedom in generation. Higher values may lead to saturation and | |
| deterioration of image quality.`,name:"guidance_scale"},{anchor:"diffusers.SmoothedEnergyGuidance.seg_guidance_scale",description:`<strong>seg_guidance_scale</strong> (<code>float</code>, defaults to <code>3.0</code>) — | |
| The scale parameter for smoothed energy guidance. Anatomy and structure coherence may improve with higher | |
| values, but it may also lead to overexposure and saturation.`,name:"seg_guidance_scale"},{anchor:"diffusers.SmoothedEnergyGuidance.seg_blur_sigma",description:`<strong>seg_blur_sigma</strong> (<code>float</code>, defaults to <code>9999999.0</code>) — | |
| The amount by which we blur the attention weights. Setting this value greater than 9999.0 results in | |
| infinite blur, which means uniform queries. Controlling it exponentially is empirically effective.`,name:"seg_blur_sigma"},{anchor:"diffusers.SmoothedEnergyGuidance.seg_blur_threshold_inf",description:`<strong>seg_blur_threshold_inf</strong> (<code>float</code>, defaults to <code>9999.0</code>) — | |
| The threshold above which the blur is considered infinite.`,name:"seg_blur_threshold_inf"},{anchor:"diffusers.SmoothedEnergyGuidance.seg_guidance_start",description:`<strong>seg_guidance_start</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The fraction of the total number of denoising steps after which smoothed energy guidance starts.`,name:"seg_guidance_start"},{anchor:"diffusers.SmoothedEnergyGuidance.seg_guidance_stop",description:`<strong>seg_guidance_stop</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| The fraction of the total number of denoising steps after which smoothed energy guidance stops.`,name:"seg_guidance_stop"},{anchor:"diffusers.SmoothedEnergyGuidance.seg_guidance_layers",description:`<strong>seg_guidance_layers</strong> (<code>int</code> or <code>list[int]</code>, <em>optional</em>) — | |
| The layer indices to apply smoothed energy guidance to. Can be a single integer or a list of integers. If | |
| not provided, <code>seg_guidance_config</code> must be provided. The recommended values are <code>[7, 8, 9]</code> for Stable | |
| Diffusion 3.5 Medium.`,name:"seg_guidance_layers"},{anchor:"diffusers.SmoothedEnergyGuidance.seg_guidance_config",description:`<strong>seg_guidance_config</strong> (<code>SmoothedEnergyGuidanceConfig</code> or <code>list[SmoothedEnergyGuidanceConfig]</code>, <em>optional</em>) — | |
| The configuration for the smoothed energy layer guidance. Can be a single <code>SmoothedEnergyGuidanceConfig</code> or | |
| a list of <code>SmoothedEnergyGuidanceConfig</code>. If not provided, <code>seg_guidance_layers</code> must be provided.`,name:"seg_guidance_config"},{anchor:"diffusers.SmoothedEnergyGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix | |
| overexposure. Based on Section 3.4 from <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are | |
| Flawed</a>.`,name:"guidance_rescale"},{anchor:"diffusers.SmoothedEnergyGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the original formulation of classifier-free guidance as proposed in the paper. By default, | |
| we use the diffusers-native implementation that has been in the codebase for a long time. See | |
| [~guiders.classifier_free_guidance.ClassifierFreeGuidance] for more details.`,name:"use_original_formulation"},{anchor:"diffusers.SmoothedEnergyGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.01</code>) — | |
| The fraction of the total number of denoising steps after which guidance starts.`,name:"start"},{anchor:"diffusers.SmoothedEnergyGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>0.2</code>) — | |
| The fraction of the total number of denoising steps after which guidance stops.`,name:"stop"}]}),r(6),i(w);var H=e(w,2);n(H,{title:"PerturbedAttentionGuidance",local:"diffusers.PerturbedAttentionGuidance",headingTag:"h2"});var x=e(H,2),re=a(x);o(re,{name:"class diffusers.PerturbedAttentionGuidance",anchor:"diffusers.PerturbedAttentionGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/perturbed_attention_guidance.py#L36",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"perturbed_guidance_scale",val:": float = 2.8"},{name:"perturbed_guidance_start",val:": float = 0.01"},{name:"perturbed_guidance_stop",val:": float = 0.2"},{name:"perturbed_guidance_layers",val:": int | list[int] | None = None"},{name:"perturbed_guidance_config",val:": LayerSkipConfig | list[LayerSkipConfig] | dict[str, Any] = None"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PerturbedAttentionGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| The scale parameter for classifier-free guidance. Higher values result in stronger conditioning on the text | |
| prompt, while lower values allow for more freedom in generation. Higher values may lead to saturation and | |
| deterioration of image quality.`,name:"guidance_scale"},{anchor:"diffusers.PerturbedAttentionGuidance.perturbed_guidance_scale",description:`<strong>perturbed_guidance_scale</strong> (<code>float</code>, defaults to <code>2.8</code>) — | |
| The scale parameter for perturbed attention guidance.`,name:"perturbed_guidance_scale"},{anchor:"diffusers.PerturbedAttentionGuidance.perturbed_guidance_start",description:`<strong>perturbed_guidance_start</strong> (<code>float</code>, defaults to <code>0.01</code>) — | |
| The fraction of the total number of denoising steps after which perturbed attention guidance starts.`,name:"perturbed_guidance_start"},{anchor:"diffusers.PerturbedAttentionGuidance.perturbed_guidance_stop",description:`<strong>perturbed_guidance_stop</strong> (<code>float</code>, defaults to <code>0.2</code>) — | |
| The fraction of the total number of denoising steps after which perturbed attention guidance stops.`,name:"perturbed_guidance_stop"},{anchor:"diffusers.PerturbedAttentionGuidance.perturbed_guidance_layers",description:`<strong>perturbed_guidance_layers</strong> (<code>int</code> or <code>list[int]</code>, <em>optional</em>) — | |
| The layer indices to apply perturbed attention guidance to. Can be a single integer or a list of integers. | |
| If not provided, <code>perturbed_guidance_config</code> must be provided.`,name:"perturbed_guidance_layers"},{anchor:"diffusers.PerturbedAttentionGuidance.perturbed_guidance_config",description:`<strong>perturbed_guidance_config</strong> (<code>LayerSkipConfig</code> or <code>list[LayerSkipConfig]</code>, <em>optional</em>) — | |
| The configuration for the perturbed attention guidance. Can be a single <code>LayerSkipConfig</code> or a list of | |
| <code>LayerSkipConfig</code>. If not provided, <code>perturbed_guidance_layers</code> must be provided.`,name:"perturbed_guidance_config"},{anchor:"diffusers.PerturbedAttentionGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix | |
| overexposure. Based on Section 3.4 from <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are | |
| Flawed</a>.`,name:"guidance_rescale"},{anchor:"diffusers.PerturbedAttentionGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the original formulation of classifier-free guidance as proposed in the paper. By default, | |
| we use the diffusers-native implementation that has been in the codebase for a long time. See | |
| [~guiders.classifier_free_guidance.ClassifierFreeGuidance] for more details.`,name:"use_original_formulation"},{anchor:"diffusers.PerturbedAttentionGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.01</code>) — | |
| The fraction of the total number of denoising steps after which guidance starts.`,name:"start"},{anchor:"diffusers.PerturbedAttentionGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>0.2</code>) — | |
| The fraction of the total number of denoising steps after which guidance stops.`,name:"stop"}]}),r(10),i(x);var J=e(x,2);n(J,{title:"AdaptiveProjectedGuidance",local:"diffusers.AdaptiveProjectedGuidance",headingTag:"h2"});var T=e(J,2),ne=a(T);o(ne,{name:"class diffusers.AdaptiveProjectedGuidance",anchor:"diffusers.AdaptiveProjectedGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/adaptive_projected_guidance.py#L30",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"adaptive_projected_guidance_momentum",val:": float | None = None"},{name:"adaptive_projected_guidance_rescale",val:": float = 15.0"},{name:"adaptive_projected_guidance_norm_dim",val:": int | tuple[int, ...] | None = None"},{name:"eta",val:": float = 1.0"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AdaptiveProjectedGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| The scale parameter for classifier-free guidance. Higher values result in stronger conditioning on the text | |
| prompt, while lower values allow for more freedom in generation. Higher values may lead to saturation and | |
| deterioration of image quality.`,name:"guidance_scale"},{anchor:"diffusers.AdaptiveProjectedGuidance.adaptive_projected_guidance_momentum",description:`<strong>adaptive_projected_guidance_momentum</strong> (<code>float</code>, defaults to <code>None</code>) — | |
| The momentum parameter for the adaptive projected guidance. Disabled if set to <code>None</code>.`,name:"adaptive_projected_guidance_momentum"},{anchor:"diffusers.AdaptiveProjectedGuidance.adaptive_projected_guidance_rescale",description:`<strong>adaptive_projected_guidance_rescale</strong> (<code>float</code>, defaults to <code>15.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix`,name:"adaptive_projected_guidance_rescale"},{anchor:"diffusers.AdaptiveProjectedGuidance.adaptive_projected_guidance_norm_dim",description:`<strong>adaptive_projected_guidance_norm_dim</strong> (<code>int</code> or <code>tuple[int]</code>, <em>optional</em>) — | |
| Dimension(s) over which to compute the APG norm and projection. If omitted, all non-batch dimensions are | |
| used, preserving the original behavior.`,name:"adaptive_projected_guidance_norm_dim"},{anchor:"diffusers.AdaptiveProjectedGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix | |
| overexposure. Based on Section 3.4 from <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are | |
| Flawed</a>.`,name:"guidance_rescale"},{anchor:"diffusers.AdaptiveProjectedGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the original formulation of classifier-free guidance as proposed in the paper. By default, | |
| we use the diffusers-native implementation that has been in the codebase for a long time. See | |
| [~guiders.classifier_free_guidance.ClassifierFreeGuidance] for more details.`,name:"use_original_formulation"},{anchor:"diffusers.AdaptiveProjectedGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The fraction of the total number of denoising steps after which guidance starts.`,name:"start"},{anchor:"diffusers.AdaptiveProjectedGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| The fraction of the total number of denoising steps after which guidance stops.`,name:"stop"}]}),r(2),i(T);var W=e(T,2);n(W,{title:"AutoGuidance",local:"diffusers.AutoGuidance",headingTag:"h2"});var S=e(W,2),te=a(S);o(te,{name:"class diffusers.AutoGuidance",anchor:"diffusers.AutoGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/auto_guidance.py#L32",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"auto_guidance_layers",val:": int | list[int] | None = None"},{name:"auto_guidance_config",val:": LayerSkipConfig | list[LayerSkipConfig] | dict[str, Any] = None"},{name:"dropout",val:": float | None = None"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.AutoGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| The scale parameter for classifier-free guidance. Higher values result in stronger conditioning on the text | |
| prompt, while lower values allow for more freedom in generation. Higher values may lead to saturation and | |
| deterioration of image quality.`,name:"guidance_scale"},{anchor:"diffusers.AutoGuidance.auto_guidance_layers",description:`<strong>auto_guidance_layers</strong> (<code>int</code> or <code>list[int]</code>, <em>optional</em>) — | |
| The layer indices to apply skip layer guidance to. Can be a single integer or a list of integers. If not | |
| provided, <code>skip_layer_config</code> must be provided.`,name:"auto_guidance_layers"},{anchor:"diffusers.AutoGuidance.auto_guidance_config",description:`<strong>auto_guidance_config</strong> (<code>LayerSkipConfig</code> or <code>list[LayerSkipConfig]</code>, <em>optional</em>) — | |
| The configuration for the skip layer guidance. Can be a single <code>LayerSkipConfig</code> or a list of | |
| <code>LayerSkipConfig</code>. If not provided, <code>skip_layer_guidance_layers</code> must be provided.`,name:"auto_guidance_config"},{anchor:"diffusers.AutoGuidance.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>) — | |
| The dropout probability for autoguidance on the enabled skip layers (either with <code>auto_guidance_layers</code> or | |
| <code>auto_guidance_config</code>). If not provided, the dropout probability will be set to 1.0.`,name:"dropout"},{anchor:"diffusers.AutoGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix | |
| overexposure. Based on Section 3.4 from <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are | |
| Flawed</a>.`,name:"guidance_rescale"},{anchor:"diffusers.AutoGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the original formulation of classifier-free guidance as proposed in the paper. By default, | |
| we use the diffusers-native implementation that has been in the codebase for a long time. See | |
| [~guiders.classifier_free_guidance.ClassifierFreeGuidance] for more details.`,name:"use_original_formulation"},{anchor:"diffusers.AutoGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The fraction of the total number of denoising steps after which guidance starts.`,name:"start"},{anchor:"diffusers.AutoGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| The fraction of the total number of denoising steps after which guidance stops.`,name:"stop"}]}),r(2),i(S);var z=e(S,2);n(z,{title:"TangentialClassifierFreeGuidance",local:"diffusers.TangentialClassifierFreeGuidance",headingTag:"h2"});var C=e(z,2),se=a(C);o(se,{name:"class diffusers.TangentialClassifierFreeGuidance",anchor:"diffusers.TangentialClassifierFreeGuidance",source:"https://github.com/huggingface/diffusers/blob/vr_13881/src/diffusers/guiders/tangential_classifier_free_guidance.py#L30",parameters:[{name:"guidance_scale",val:": float = 7.5"},{name:"guidance_rescale",val:": float = 0.0"},{name:"use_original_formulation",val:": bool = False"},{name:"start",val:": float = 0.0"},{name:"stop",val:": float = 1.0"},{name:"enabled",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.TangentialClassifierFreeGuidance.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>7.5</code>) — | |
| The scale parameter for classifier-free guidance. Higher values result in stronger conditioning on the text | |
| prompt, while lower values allow for more freedom in generation. Higher values may lead to saturation and | |
| deterioration of image quality.`,name:"guidance_scale"},{anchor:"diffusers.TangentialClassifierFreeGuidance.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The rescale factor applied to the noise predictions. This is used to improve image quality and fix | |
| overexposure. Based on Section 3.4 from <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are | |
| Flawed</a>.`,name:"guidance_rescale"},{anchor:"diffusers.TangentialClassifierFreeGuidance.use_original_formulation",description:`<strong>use_original_formulation</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to use the original formulation of classifier-free guidance as proposed in the paper. By default, | |
| we use the diffusers-native implementation that has been in the codebase for a long time. See | |
| [~guiders.classifier_free_guidance.ClassifierFreeGuidance] for more details.`,name:"use_original_formulation"},{anchor:"diffusers.TangentialClassifierFreeGuidance.start",description:`<strong>start</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The fraction of the total number of denoising steps after which guidance starts.`,name:"start"},{anchor:"diffusers.TangentialClassifierFreeGuidance.stop",description:`<strong>stop</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| The fraction of the total number of denoising steps after which guidance stops.`,name:"stop"}]}),r(2),i(C);var de=e(C,2);fe(de,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/modular_diffusers/guiders.md"}),r(2),l(R,A),me()}export{ke as component}; | |
Xet Storage Details
- Size:
- 51.1 kB
- Xet hash:
- afec1fdbf8b7d112e72844e4d0642a704a126658dcbac6be9c16c4bbaeab97fc
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.