Buckets:

download
raw
28.6 kB
import"../chunks/DsnmJJEf.js";import{i as le,h as pe,C as me,H as a,D as n,E as ue,s as fe,a as ge}from"../chunks/BtE7mKSK.js";import{p as _e,o as he,s as e,f as G,a as N,b as ve,c as o,d as T,n as r,r as t}from"../chunks/jDjavuwI.js";import{E as be}from"../chunks/SrSJA0zO.js";const ye='{"title":"Components and configs","local":"components-and-configs","sections":[{"title":"ComponentSpec","local":"diffusers.ComponentSpec","sections":[],"depth":2},{"title":"ConfigSpec","local":"diffusers.ConfigSpec","sections":[],"depth":2},{"title":"ComponentsManager","local":"diffusers.ComponentsManager","sections":[],"depth":2},{"title":"InsertableDict","local":"diffusers.modular_pipelines.InsertableDict","sections":[],"depth":2}],"depth":1}';var xe=T('<meta name="hf:doc:metadata"/>'),Ce=T("<p>Example:</p> <!>",1),Me=T(`<p></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>Specification for a pipeline component.</p> <p>A component can be created in two ways:</p> <ol><li>From scratch using <strong>init</strong> with a config dict</li> <li>using <code>from_pretrained</code></li></ol> <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>Create component using from_config with config.</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>Decode a load_id string back into a dictionary of loading fields and values.</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>Create a ComponentSpec from a Component.</p> <p>Currently supports:</p> <ul><li>Components created with <code>ComponentSpec.load()</code> method</li> <li>Components that are ConfigMixin subclasses but not nn.Modules (e.g. schedulers, guiders)</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>Load component using from_pretrained.</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>Return the names of all loading‐related fields (i.e. those whose field.metadata[“loading”] is True).</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>Specification for a pipeline configuration parameter.</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>A central registry and management system for model components across multiple pipelines.</p> <p><a href="/docs/diffusers/pr_14304/en/api/modular_diffusers/pipeline_components#diffusers.ComponentsManager">ComponentsManager</a> provides a unified way to register, track, and reuse model components (like UNet, VAE, text
encoders, etc.) across different modular pipelines. It includes features for duplicate detection, memory
management, and component organization.</p> <blockquote class="warning"><p>> This is an experimental feature and is likely to change in the future.</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>Add a component to the ComponentsManager.</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>Disable automatic CPU offloading for all components.</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>Enable automatic CPU offloading for all components.</p> <p>The algorithm works as follows:</p> <ol><li>All models start on CPU by default</li> <li>When a model’s forward pass is called, it’s moved to the execution device</li> <li>If it doesn’t fit into the memory currently available on the device minus <code>memory_reserve</code>, other models
on the device are moved back to CPU first</li> <li>The system tries to offload the smallest combination of models that frees enough memory</li> <li>Models stay on the execution device until another model needs memory and forces them off</li> <li>If a forward pass still runs out of device memory, the smallest model on the device is offloaded and the
forward is retried, escalating one model at a time until it fits (inference only: each retried forward
re-runs from its original inputs)</li></ol> <p>Every move the offloader makes is recorded in <code>offload_record</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>Get components by a list of IDs.</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>Get components by a list of names, optionally filtered by collection.</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>Get component IDs by a list of names, optionally filtered by collection.</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>Get comprehensive information about a component.</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>Get a single component by either:</p> <ul><li>searching name (pattern matching), collection, or load_id.</li> <li>passing in a component_id
Raises an error if multiple components match or none are found.</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>Remove a component from the ComponentsManager.</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>Remove a component from a collection.</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>Search components by name with simple pattern matching. Optionally filter by collection or load_id.</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"><!></div> <!> <p></p>`,1);function Ie(Z,R){_e(R,!1),he(()=>{new URLSearchParams(window.location.search).get("fw")}),le();var I=Me();pe("7v6pso",s=>{var D=xe();fe(D,"content",ye),N(s,D)});var S=e(G(I),2);me(S,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var k=e(S,2);a(k,{title:"Components and configs",local:"components-and-configs",headingTag:"h1"});var J=e(k,2);a(J,{title:"ComponentSpec",local:"diffusers.ComponentSpec",headingTag:"h2"});var i=e(J,2),j=o(i);n(j,{name:"class diffusers.ComponentSpec",anchor:"diffusers.ComponentSpec",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L97",parameters:[{name:"name",val:": str | None = None"},{name:"type_hint",val:": typing.Optional[typing.Type] = None"},{name:"description",val:": str | None = None"},{name:"config",val:": diffusers.configuration_utils.FrozenDict | None = None"},{name:"pretrained_model_name_or_path",val:": str | list[str] | None = None"},{name:"subfolder",val:": str | None = ''"},{name:"variant",val:": str | None = None"},{name:"revision",val:": str | None = None"},{name:"default_creation_method",val:": typing.Literal['from_config', 'from_pretrained'] = 'from_pretrained'"},{name:"repo",val:": str | list[str] | None = None"}],parametersDescription:[{anchor:"diffusers.ComponentSpec.name",description:"<strong>name</strong> &#x2014; Name of the component",name:"name"},{anchor:"diffusers.ComponentSpec.type_hint",description:"<strong>type_hint</strong> &#x2014; Type of the component (e.g. UNet2DConditionModel)",name:"type_hint"},{anchor:"diffusers.ComponentSpec.description",description:"<strong>description</strong> &#x2014; Optional description of the component",name:"description"},{anchor:"diffusers.ComponentSpec.config",description:"<strong>config</strong> &#x2014; Optional config dict for <strong>init</strong> creation",name:"config"},{anchor:"diffusers.ComponentSpec.pretrained_model_name_or_path",description:"<strong>pretrained_model_name_or_path</strong> &#x2014; Optional pretrained_model_name_or_path path for from_pretrained creation",name:"pretrained_model_name_or_path"},{anchor:"diffusers.ComponentSpec.subfolder",description:"<strong>subfolder</strong> &#x2014; Optional subfolder in pretrained_model_name_or_path",name:"subfolder"},{anchor:"diffusers.ComponentSpec.variant",description:"<strong>variant</strong> &#x2014; Optional variant in pretrained_model_name_or_path",name:"variant"},{anchor:"diffusers.ComponentSpec.revision",description:"<strong>revision</strong> &#x2014; Optional revision in pretrained_model_name_or_path",name:"revision"},{anchor:"diffusers.ComponentSpec.default_creation_method",description:"<strong>default_creation_method</strong> &#x2014; Preferred creation method - &#x201C;from_config&#x201D; or &#x201C;from_pretrained&#x201D;",name:"default_creation_method"}]});var d=e(j,8),F=o(d);n(F,{name:"create",anchor:"diffusers.ComponentSpec.create",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L266",parameters:[{name:"config",val:": diffusers.configuration_utils.FrozenDict | dict[str, typing.Any] | None = None"},{name:"**kwargs",val:""}]}),r(2),t(d);var c=e(d,2),A=o(c);n(A,{name:"decode_load_id",anchor:"diffusers.ComponentSpec.decode_load_id",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L227",parameters:[{name:"load_id",val:": str"}],parametersDescription:[{anchor:"diffusers.ComponentSpec.decode_load_id.load_id",description:`<strong>load_id</strong> &#x2014; The load_id string to decode, format: &#x201C;pretrained_model_name_or_path|subfolder|variant|revision&#x201D;
where None values are represented as &#x201C;null&#x201D;`,name:"load_id"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>Dict mapping loading field names to their values. e.g. {
“pretrained_model_name_or_path”: “path/to/repo”, “subfolder”: “subfolder”, “variant”: “variant”,
“revision”: “revision”
} If a segment value is “null”, it’s replaced with None. Returns None if load_id is “null” (indicating
component not created with <code>load</code> method).</p>
`}),r(2),t(c);var l=e(c,2),Y=o(l);n(Y,{name:"from_component",anchor:"diffusers.ComponentSpec.from_component",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L148",parameters:[{name:"name",val:": str"},{name:"component",val:": typing.Any"}],parametersDescription:[{anchor:"diffusers.ComponentSpec.from_component.name",description:"<strong>name</strong> &#x2014; Name of the component",name:"name"},{anchor:"diffusers.ComponentSpec.from_component.component",description:"<strong>component</strong> &#x2014; Component object to create spec from",name:"component"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>ComponentSpec object</p>
`,raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<ul>
<li><code>ValueError</code> — If component is not supported (e.g. nn.Module without load_id, non-ConfigMixin)</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>ValueError</code></p>
`}),r(6),t(l);var p=e(l,2),P=o(p);n(P,{name:"load",anchor:"diffusers.ComponentSpec.load",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L294",parameters:[{name:"**kwargs",val:""}]}),r(2),t(p);var E=e(p,2),Q=o(E);n(Q,{name:"loading_fields",anchor:"diffusers.ComponentSpec.loading_fields",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L208",parameters:[]}),r(2),t(E),t(i);var L=e(i,2);a(L,{title:"ConfigSpec",local:"diffusers.ConfigSpec",headingTag:"h2"});var m=e(L,2),z=o(m);n(z,{name:"class diffusers.ConfigSpec",anchor:"diffusers.ConfigSpec",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L353",parameters:[{name:"name",val:": str"},{name:"default",val:": typing.Any"},{name:"description",val:": str | None = None"}]}),r(2),t(m);var B=e(m,2);a(B,{title:"ComponentsManager",local:"diffusers.ComponentsManager",headingTag:"h2"});var u=e(B,2),W=o(u);n(W,{name:"class diffusers.ComponentsManager",anchor:"diffusers.ComponentsManager",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L584",parameters:[]});var O=e(W,8);be(O,{anchor:"diffusers.ComponentsManager.example",children:(s,D)=>{var q=Ce(),ce=e(G(q),2);ge(ce,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvbXBvbmVudHNNYW5hZ2VyJTBBJTBBJTIzJTIwQ3JlYXRlJTIwYSUyMGNvbXBvbmVudHMlMjBtYW5hZ2VyJTBBY20lMjAlM0QlMjBDb21wb25lbnRzTWFuYWdlcigpJTBBJTBBJTIzJTIwQWRkJTIwY29tcG9uZW50cyUwQWNtLmFkZCglMjJ1bmV0JTIyJTJDJTIwdW5ldF9tb2RlbCUyQyUyMGNvbGxlY3Rpb24lM0QlMjJzZHhsJTIyKSUwQWNtLmFkZCglMjJ2YWUlMjIlMkMlMjB2YWVfbW9kZWwlMkMlMjBjb2xsZWN0aW9uJTNEJTIyc2R4bCUyMiklMEElMEElMjMlMjBFbmFibGUlMjBhdXRvJTIwb2ZmbG9hZGluZyUwQWNtLmVuYWJsZV9hdXRvX2NwdV9vZmZsb2FkKCklMEElMEElMjMlMjBSZXRyaWV2ZSUyMGNvbXBvbmVudHMlMEF1bmV0JTIwJTNEJTIwY20uZ2V0X29uZShuYW1lJTNEJTIydW5ldCUyMiUyQyUyMGNvbGxlY3Rpb24lM0QlMjJzZHhsJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ComponentsManager
<span class="hljs-comment"># Create a components manager</span>
cm = ComponentsManager()
<span class="hljs-comment"># Add components</span>
cm.add(<span class="hljs-string">&quot;unet&quot;</span>, unet_model, collection=<span class="hljs-string">&quot;sdxl&quot;</span>)
cm.add(<span class="hljs-string">&quot;vae&quot;</span>, vae_model, collection=<span class="hljs-string">&quot;sdxl&quot;</span>)
<span class="hljs-comment"># Enable auto offloading</span>
cm.enable_auto_cpu_offload()
<span class="hljs-comment"># Retrieve components</span>
unet = cm.get_one(name=<span class="hljs-string">&quot;unet&quot;</span>, collection=<span class="hljs-string">&quot;sdxl&quot;</span>)`,lang:"python",wrap:!1}),N(s,q)},$$slots:{default:!0}});var f=e(O,2),X=o(f);n(X,{name:"add",anchor:"diffusers.ComponentsManager.add",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L683",parameters:[{name:"name",val:": str"},{name:"component",val:": Any"},{name:"collection",val:": str | None = None"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.add.name",description:"<strong>name</strong> (str) &#x2014; The name of the component",name:"name"},{anchor:"diffusers.ComponentsManager.add.component",description:"<strong>component</strong> (Any) &#x2014; The component to add",name:"component"},{anchor:"diffusers.ComponentsManager.add.collection",description:"<strong>collection</strong> (str | None) &#x2014; The collection to add the component to",name:"collection"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The unique component ID, which is generated as “{name}_{id(component)}” where
id(component) is Python’s built-in unique identifier for the object</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p>str</p>
`}),r(2),t(f);var g=e(f,2),H=o(g);n(H,{name:"disable_auto_cpu_offload",anchor:"diffusers.ComponentsManager.disable_auto_cpu_offload",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L1124",parameters:[]}),r(2),t(g);var _=e(g,2),$=o(_);n($,{name:"enable_auto_cpu_offload",anchor:"diffusers.ComponentsManager.enable_auto_cpu_offload",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L991",parameters:[{name:"device",val:": str | int | torch.device = None"},{name:"memory_reserve",val:": str | int = '3GB'"},{name:"retry_on_oom",val:": bool = True"},{name:"measure_activations",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.enable_auto_cpu_offload.device",description:"<strong>device</strong> (str | int | torch.device) &#x2014; The execution device where models are moved for forward passes",name:"device"},{anchor:"diffusers.ComponentsManager.enable_auto_cpu_offload.memory_reserve",description:`<strong>memory_reserve</strong> (str | int, <em>optional</em>, defaults to <code>&quot;3GB&quot;</code>) &#x2014;
The amount of available device memory to keep free when deciding whether an incoming model fits,
checked at each offloading decision &#x2014; e.g. <code>&quot;3GB&quot;</code> or a number of bytes. The reserve is what covers
allocations the offloading cannot see, mainly activations, which scale with resolution / batch size /
sequence length. Set it to <code>0</code> to keep as much on the device as possible, relying on the OOM retry.`,name:"memory_reserve"},{anchor:"diffusers.ComponentsManager.enable_auto_cpu_offload.retry_on_oom",description:`<strong>retry_on_oom</strong> (bool, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to recover from a forward pass that runs out of device memory by offloading the models on the
device one at a time, smallest first, and retrying until it fits. Set it to <code>False</code> to raise the error
instead &#x2014; the forward passes are then left untouched.`,name:"retry_on_oom"},{anchor:"diffusers.ComponentsManager.enable_auto_cpu_offload.measure_activations",description:`<strong>measure_activations</strong> (bool, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to measure how much device memory each forward pass needs on top of the weights, and report
the <code>memory_reserve</code> that would have covered it (see <code>offload_record</code>). This
resets the device&#x2019;s peak-memory stats around every forward pass, so leave it off if you are measuring
peak memory yourself.`,name:"measure_activations"}]}),r(8),t(_);var h=e(_,2),K=o(h);n(K,{name:"get_components_by_ids",anchor:"diffusers.ComponentsManager.get_components_by_ids",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L1435",parameters:[{name:"ids",val:": list[str]"},{name:"return_dict_with_names",val:": bool | None = True"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.get_components_by_ids.ids",description:`<strong>ids</strong> (list[str]) &#x2014;
list of component IDs`,name:"ids"},{anchor:"diffusers.ComponentsManager.get_components_by_ids.return_dict_with_names",description:`<strong>return_dict_with_names</strong> (bool | None) &#x2014;
Whether to return a dictionary with component names as keys:`,name:"return_dict_with_names"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>Dictionary of components.</p>
<ul>
<li>If return_dict_with_names=True, keys are component names.</li>
<li>If return_dict_with_names=False, keys are component IDs.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p>dict[str, Any]</p>
`,raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<ul>
<li><code>ValueError</code> — If duplicate component names are found in the search results when return_dict_with_names=True</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>ValueError</code></p>
`}),r(2),t(h);var v=e(h,2),ee=o(v);n(ee,{name:"get_components_by_names",anchor:"diffusers.ComponentsManager.get_components_by_names",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L1468",parameters:[{name:"names",val:": list[str]"},{name:"collection",val:": str | None = None"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.get_components_by_names.names",description:"<strong>names</strong> (list[str]) &#x2014; list of component names",name:"names"},{anchor:"diffusers.ComponentsManager.get_components_by_names.collection",description:"<strong>collection</strong> (str | None) &#x2014; Optional collection to filter by",name:"collection"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>Dictionary of components with component names as keys</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p>dict[str, Any]</p>
`,raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<ul>
<li><code>ValueError</code> — If duplicate component names are found in the search results</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>ValueError</code></p>
`}),r(2),t(v);var b=e(v,2),ne=o(b);n(ne,{name:"get_ids",anchor:"diffusers.ComponentsManager.get_ids",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L1417",parameters:[{name:"names",val:": str | list[str] = None"},{name:"collection",val:": str | None = None"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.get_ids.names",description:"<strong>names</strong> (str | list[str]) &#x2014; list of component names",name:"names"},{anchor:"diffusers.ComponentsManager.get_ids.collection",description:"<strong>collection</strong> (str | None) &#x2014; Optional collection to filter by",name:"collection"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>list of component IDs</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p>list[str]</p>
`}),r(2),t(b);var y=e(b,2),oe=o(y);n(oe,{name:"get_model_info",anchor:"diffusers.ComponentsManager.get_model_info",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L1143",parameters:[{name:"component_id",val:": str"},{name:"fields",val:": str | list[str] | None = None"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.get_model_info.component_id",description:"<strong>component_id</strong> (str) &#x2014; Name of the component to get info for",name:"component_id"},{anchor:"diffusers.ComponentsManager.get_model_info.fields",description:`<strong>fields</strong> (str | list[str] | None) &#x2014;
Field(s) to return. Can be a string for single field or list of fields. If None, uses the
available_info_fields setting.`,name:"fields"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>Dictionary containing requested component metadata. If fields is specified, returns only those fields.
Otherwise, returns all fields.</p>
`}),r(2),t(y);var x=e(y,2),te=o(x);n(te,{name:"get_one",anchor:"diffusers.ComponentsManager.get_one",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L1372",parameters:[{name:"component_id",val:": str | None = None"},{name:"name",val:": str | None = None"},{name:"collection",val:": str | None = None"},{name:"load_id",val:": str | None = None"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.get_one.component_id",description:"<strong>component_id</strong> (str | None) &#x2014; Optional component ID to get",name:"component_id"},{anchor:"diffusers.ComponentsManager.get_one.name",description:"<strong>name</strong> (str | None) &#x2014; Component name or pattern",name:"name"},{anchor:"diffusers.ComponentsManager.get_one.collection",description:"<strong>collection</strong> (str | None) &#x2014; Optional collection to filter by",name:"collection"},{anchor:"diffusers.ComponentsManager.get_one.load_id",description:"<strong>load_id</strong> (str | None) &#x2014; Optional load_id to filter by",name:"load_id"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>A single component</p>
`,raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<ul>
<li><code>ValueError</code> — If no components match or multiple components match</li>
</ul>
`,raiseType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>ValueError</code></p>
`}),r(4),t(x);var C=e(x,2),re=o(C);n(re,{name:"remove",anchor:"diffusers.ComponentsManager.remove",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L773",parameters:[{name:"component_id",val:": str = None"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.remove.component_id",description:"<strong>component_id</strong> (str) &#x2014; The ID of the component to remove",name:"component_id"}]}),r(2),t(C);var M=e(C,2),ae=o(M);n(ae,{name:"remove_from_collection",anchor:"diffusers.ComponentsManager.remove_from_collection",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L755",parameters:[{name:"component_id",val:": str"},{name:"collection",val:": str"}]}),r(2),t(M);var U=e(M,2),se=o(U);n(se,{name:"search_components",anchor:"diffusers.ComponentsManager.search_components",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/components_manager.py#L805",parameters:[{name:"names",val:": str | None = None"},{name:"collection",val:": str | None = None"},{name:"load_id",val:": str | None = None"},{name:"return_dict_with_names",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ComponentsManager.search_components.names",description:`<strong>names</strong> &#x2014; Component name(s) or pattern(s)
Patterns:
<ul>
<li>&#x201C;unet&#x201D; : match any component with base name &#x201C;unet&#x201D; (e.g., unet_123abc)</li>
<li>&#x201C;!unet&#x201D; : everything except components with base name &#x201C;unet&#x201D;</li>
<li>&#x201C;unet*&#x201D; : anything with base name starting with &#x201C;unet&#x201D;</li>
<li>&#x201C;!unet*&#x201D; : anything with base name NOT starting with &#x201C;unet&#x201D;</li>
<li>&#x201D;<em>unet</em>&#x201D; : anything with base name containing &#x201C;unet&#x201D;</li>
<li>&#x201C;!<em>unet</em>&#x201D; : anything with base name NOT containing &#x201C;unet&#x201D;</li>
<li>&#x201C;refiner|vae|unet&#x201D; : anything with base name exactly matching &#x201C;refiner&#x201D;, &#x201C;vae&#x201D;, or &#x201C;unet&#x201D;</li>
<li>&#x201C;!refiner|vae|unet&#x201D; : anything with base name NOT exactly matching &#x201C;refiner&#x201D;, &#x201C;vae&#x201D;, or &#x201C;unet&#x201D;</li>
<li>&#x201C;unet<em>|vae</em>&#x201D; : anything with base name starting with &#x201C;unet&#x201D; OR starting with &#x201C;vae&#x201D;</li>
</ul>`,name:"names"},{anchor:"diffusers.ComponentsManager.search_components.collection",description:"<strong>collection</strong> &#x2014; Optional collection to filter by",name:"collection"},{anchor:"diffusers.ComponentsManager.search_components.load_id",description:"<strong>load_id</strong> &#x2014; Optional load_id to filter by",name:"load_id"},{anchor:"diffusers.ComponentsManager.search_components.return_dict_with_names",description:`<strong>return_dict_with_names</strong> &#x2014;
If True, returns a dictionary with component names as keys, throw an error if
multiple components with the same name are found If False, returns a dictionary
with component IDs as keys`,name:"return_dict_with_names"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>Dictionary mapping component names to components if return_dict_with_names=True, or a dictionary mapping
component IDs to components if return_dict_with_names=False</p>
`}),r(2),t(U),t(u);var V=e(u,2);a(V,{title:"InsertableDict",local:"diffusers.modular_pipelines.InsertableDict",headingTag:"h2"});var w=e(V,2),ie=o(w);n(ie,{name:"class diffusers.modular_pipelines.InsertableDict",anchor:"diffusers.modular_pipelines.InsertableDict",source:"https://github.com/huggingface/diffusers/blob/vr_14304/src/diffusers/modular_pipelines/modular_pipeline_utils.py#L59",parameters:""}),t(w);var de=e(w,2);ue(de,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/modular_diffusers/pipeline_components.md"}),r(2),N(Z,I),ve()}export{Ie as component};

Xet Storage Details

Size:
28.6 kB
·
Xet hash:
50df08d41ff338503692efdb3a1d198c6597dbda325afe83ad53b3e4b4063a78

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.