Buckets:
| import"../chunks/DsnmJJEf.js";import{i as D,h as I,C as W,H as M,D as o,E as R,s as E,a as G}from"../chunks/BtE7mKSK.js";import{p as P,o as L,s as e,f as w,a as u,b as F,c as n,d as g,n as s,r as i}from"../chunks/jDjavuwI.js";import{E as V}from"../chunks/SrSJA0zO.js";const B='{"title":"Configuration","local":"configuration","sections":[{"title":"ConfigMixin","local":"diffusers.ConfigMixin","sections":[],"depth":2}],"depth":1}';var A=g('<meta name="hf:doc:metadata"/>'),H=g("<p>Examples:</p> <!>",1),Y=g(`<p></p> <!> <!> <p>Schedulers from <a href="/docs/diffusers/pr_14358/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and models from <a href="/docs/diffusers/pr_14358/en/api/models/overview#diffusers.ModelMixin">ModelMixin</a> inherit from <a href="/docs/diffusers/pr_14358/en/api/configuration#diffusers.ConfigMixin">ConfigMixin</a> which stores all the parameters that are passed to their respective <code>__init__</code> methods in a JSON-configuration file.</p> <blockquote class="tip"><p>To use private or <a href="https://huggingface.co/docs/hub/models-gated#gated-models" rel="nofollow">gated</a> models, log-in with <code>hf auth login</code>.</p></blockquote> <!> <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 for all configuration classes. All configuration parameters are stored under <code>self.config</code>. Also | |
| provides the <a href="/docs/diffusers/pr_14358/en/api/configuration#diffusers.ConfigMixin.from_config">from_config()</a> and <a href="/docs/diffusers/pr_14358/en/api/configuration#diffusers.ConfigMixin.save_config">save_config()</a> methods for loading, downloading, and | |
| saving classes that inherit from <a href="/docs/diffusers/pr_14358/en/api/configuration#diffusers.ConfigMixin">ConfigMixin</a>.</p> <p>Class attributes:</p> <ul><li><strong>config_name</strong> (<code>str</code>) — A filename under which the config should stored when calling <a href="/docs/diffusers/pr_14358/en/api/configuration#diffusers.ConfigMixin.save_config">save_config()</a> (should be overridden by parent class).</li> <li><strong>ignore_for_config</strong> (<code>list[str]</code>) — A list of attributes that should not be saved in the config (should be | |
| overridden by subclass).</li> <li><strong>has_compatibles</strong> (<code>bool</code>) — Whether the class has compatible classes (should be overridden by subclass).</li> <li><strong>_deprecated_kwargs</strong> (<code>list[str]</code>) — Keyword arguments that are deprecated. Note that the <code>init</code> function | |
| should only have a <code>kwargs</code> argument if at least one argument is deprecated (should be overridden by | |
| subclass).</li></ul> <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>Load a model or scheduler configuration.</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 Python class from a config dictionary.</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 configuration object to the directory specified in <code>save_directory</code> so that it can be reloaded using the <a href="/docs/diffusers/pr_14358/en/api/configuration#diffusers.ConfigMixin.from_config">from_config()</a> class method.</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 the configuration instance’s parameters to a JSON file.</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>Serializes the configuration instance to a JSON string.</p></div></div> <!> <p></p>`,1);function X(k,C){P(C,!1),L(()=>{new URLSearchParams(window.location.search).get("fw")}),D();var h=Y();I("1hrtv86",r=>{var f=A();E(f,"content",B),u(r,f)});var p=e(w(h),2);W(p,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var m=e(p,2);M(m,{title:"Configuration",local:"configuration",headingTag:"h1"});var _=e(m,6);M(_,{title:"ConfigMixin",local:"diffusers.ConfigMixin",headingTag:"h2"});var t=e(_,2),b=n(t);o(b,{name:"class diffusers.ConfigMixin",anchor:"diffusers.ConfigMixin",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/configuration_utils.py#L87",parameters:[]});var a=e(b,8),T=n(a);o(T,{name:"load_config",anchor:"diffusers.ConfigMixin.load_config",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/configuration_utils.py#L322",parameters:[{name:"pretrained_model_name_or_path",val:": str | os.PathLike"},{name:"return_unused_kwargs",val:" = False"},{name:"return_commit_hash",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.ConfigMixin.load_config.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 model weights saved with | |
| <a href="/docs/diffusers/pr_14358/en/api/configuration#diffusers.ConfigMixin.save_config">save_config()</a>.</li> | |
| </ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.ConfigMixin.load_config.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.ConfigMixin.load_config.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.ConfigMixin.load_config.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.ConfigMixin.load_config.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.ConfigMixin.load_config.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <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"},{anchor:"diffusers.ConfigMixin.load_config.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.ConfigMixin.load_config.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"},{anchor:"diffusers.ConfigMixin.load_config.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>""</code>) — | |
| The subfolder location of a model file within a larger model repository on the Hub or locally.`,name:"subfolder"},{anchor:"diffusers.ConfigMixin.load_config.return_unused_kwargs",description:"<strong>return_unused_kwargs</strong> (<code>bool</code>, <em>optional</em>, defaults to `False) —\nWhether unused keyword arguments of the config are returned.",name:"return_unused_kwargs"},{anchor:"diffusers.ConfigMixin.load_config.return_commit_hash",description:"<strong>return_commit_hash</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False) -- Whether the </code>commit_hash` of the loaded configuration are returned.",name:"return_commit_hash"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A dictionary of all the parameters stored in a JSON configuration file.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>dict</code></p> | |
| `}),s(2),i(a);var d=e(a,2),v=n(d);o(v,{name:"from_config",anchor:"diffusers.ConfigMixin.from_config",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/configuration_utils.py#L221",parameters:[{name:"config",val:": diffusers.configuration_utils.FrozenDict | dict[str, typing.Any] = None"},{name:"return_unused_kwargs",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.ConfigMixin.from_config.config",description:`<strong>config</strong> (<code>dict[str, Any]</code>) — | |
| A config dictionary from which the Python class is instantiated. Make sure to only load configuration | |
| files of compatible classes.`,name:"config"},{anchor:"diffusers.ConfigMixin.from_config.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.ConfigMixin.from_config.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) — | |
| Can be used to update the configuration object (after it is loaded) and initiate the Python class. | |
| <code>**kwargs</code> are passed directly to the underlying scheduler/model’s <code>__init__</code> method and eventually | |
| overwrite the same named arguments in <code>config</code>.`,name:"kwargs"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A model or scheduler object instantiated from a config dictionary.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_14358/en/api/models/overview#diffusers.ModelMixin" | |
| >ModelMixin</a> or <a | |
| href="/docs/diffusers/pr_14358/en/api/schedulers/overview#diffusers.SchedulerMixin" | |
| >SchedulerMixin</a></p> | |
| `});var j=e(v,4);V(j,{anchor:"diffusers.ConfigMixin.from_config.example",children:(r,f)=>{var x=H(),Z=e(w(x),2);G(Z,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEREUE1TY2hlZHVsZXIlMkMlMjBERElNU2NoZWR1bGVyJTJDJTIwUE5ETVNjaGVkdWxlciUwQSUwQSUyMyUyMERvd25sb2FkJTIwc2NoZWR1bGVyJTIwZnJvbSUyMGh1Z2dpbmdmYWNlLmNvJTIwYW5kJTIwY2FjaGUuJTBBc2NoZWR1bGVyJTIwJTNEJTIwRERQTVNjaGVkdWxlci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGZGRwbS1jaWZhcjEwLTMyJTIyKSUwQSUwQSUyMyUyMEluc3RhbnRpYXRlJTIwRERJTSUyMHNjaGVkdWxlciUyMGNsYXNzJTIwd2l0aCUyMHNhbWUlMjBjb25maWclMjBhcyUyMEREUE0lMEFzY2hlZHVsZXIlMjAlM0QlMjBERElNU2NoZWR1bGVyLmZyb21fY29uZmlnKHNjaGVkdWxlci5jb25maWcpJTBBJTBBJTIzJTIwSW5zdGFudGlhdGUlMjBQTkRNJTIwc2NoZWR1bGVyJTIwY2xhc3MlMjB3aXRoJTIwc2FtZSUyMGNvbmZpZyUyMGFzJTIwRERQTSUwQXNjaGVkdWxlciUyMCUzRCUyMFBORE1TY2hlZHVsZXIuZnJvbV9jb25maWcoc2NoZWR1bGVyLmNvbmZpZyk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDPMScheduler, DDIMScheduler, PNDMScheduler | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Download scheduler from huggingface.co and cache.</span> | |
| <span class="hljs-meta">>>> </span>scheduler = DDPMScheduler.from_pretrained(<span class="hljs-string">"google/ddpm-cifar10-32"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Instantiate DDIM scheduler class with same config as DDPM</span> | |
| <span class="hljs-meta">>>> </span>scheduler = DDIMScheduler.from_config(scheduler.config) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Instantiate PNDM scheduler class with same config as DDPM</span> | |
| <span class="hljs-meta">>>> </span>scheduler = PNDMScheduler.from_config(scheduler.config)`,lang:"python",wrap:!1}),u(r,x)},$$slots:{default:!0}}),i(d);var c=e(d,2),J=n(c);o(J,{name:"save_config",anchor:"diffusers.ConfigMixin.save_config",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/configuration_utils.py#L177",parameters:[{name:"save_directory",val:": str | os.PathLike"},{name:"push_to_hub",val:": bool = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.ConfigMixin.save_config.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) — | |
| Directory where the configuration JSON file is saved (will be created if it does not exist).`,name:"save_directory"},{anchor:"diffusers.ConfigMixin.save_config.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.ConfigMixin.save_config.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_14358/en/api/models/overview#diffusers.utils.PushToHubMixin.push_to_hub">push_to_hub()</a> method.`,name:"kwargs"}]}),s(2),i(c);var l=e(c,2),S=n(l);o(S,{name:"to_json_file",anchor:"diffusers.ConfigMixin.to_json_file",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/configuration_utils.py#L659",parameters:[{name:"json_file_path",val:": str | os.PathLike"}],parametersDescription:[{anchor:"diffusers.ConfigMixin.to_json_file.json_file_path",description:`<strong>json_file_path</strong> (<code>str</code> or <code>os.PathLike</code>) — | |
| Path to the JSON file to save a configuration instance’s parameters.`,name:"json_file_path"}]}),s(2),i(l);var y=e(l,2),N=n(y);o(N,{name:"to_json_string",anchor:"diffusers.ConfigMixin.to_json_string",source:"https://github.com/huggingface/diffusers/blob/vr_14358/src/diffusers/configuration_utils.py#L614",parameters:[],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>String containing all the attributes that make up the configuration instance in JSON format.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>str</code></p> | |
| `}),s(2),i(y),i(t);var U=e(t,2);R(U,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/configuration.md"}),s(2),u(k,h),F()}export{X as component}; | |
Xet Storage Details
- Size:
- 15.5 kB
- Xet hash:
- 09442750b3313201942424fce8ce1549fe06e87e013f4922e5f671f92deefcc3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.