Diffusers documentation

Pipeline 状态

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Pipeline 状态

PipelineState

class diffusers.modular_pipelines.PipelineState

< >

( values: dict[str, typing.Any] = <factory>kwargs_mapping: dict[str, list[str]] = <factory> )

PipelineState 存储流水线的状态。它用于在流水线块之间传递数据。

获取

< >

( keys: str | list[str]default: Any = None ) → Any | dict[str, Any]

参数

  • keys (str | list[str]) — 值对应的键或键列表
  • default(Any)— 如果未找到,则返回的默认值

返回值

Any | dict[str, Any]

如果 keys 是 str,则为单个值;如果 keys 是 list,则为值的字典

从 pipeline 状态中获取一个或多个值。

get_by_kwargs

< >

( kwargs_type: str ) → dict[str, Any]

参数

  • kwargs_type(str)— 用于筛选的 kwargs_type

返回值

dict[str, Any]

与 kwargs_type 匹配的值字典

获取所有与 kwargs_type 匹配的值。

set

< >

( key: strvalue: Anykwargs_type: str = None )

参数

  • key (str) — 该值对应的键
  • value (Any) — 要存储的值
  • kwargs_type (str) — 与该值关联的 kwargs_type

向流水线状态添加一个值。

to_dict

< >

( )

将 PipelineState 转换为字典。

BlockState

class diffusers.modular_pipelines.BlockState

< >

( **kwargs )

用于块状态数据的容器,支持属性访问和格式化表示。

as_dict

< >

( ) → dict[str, Any]

返回值

dict[str, Any]

包含 BlockState 所有属性的字典

将 BlockState 转换为字典。

Update on GitHub