跳到内容

GlobalStep

本节包含 GlobalStep 类的 API 参考。

有关如何使用现有全局步骤或创建自定义步骤的更多信息和示例,请参阅 教程 - Step - GlobalStep

GlobalStep

基类: Step, ABC

一种特殊的 Step 类型,其 process 方法一次接收其先前步骤处理的所有数据,而不是分批接收。当处理逻辑需要一次性处理所有数据时,此类步骤非常有用,例如训练模型、执行全局聚合等。

源代码位于 src/distilabel/steps/base.py
class GlobalStep(Step, ABC):
    """A special kind of `Step` which it's `process` method receives all the data processed
    by their previous steps at once, instead of receiving it in batches. This kind of steps
    are useful when the processing logic requires to have all the data at once, for example
    to train a model, to perform a global aggregation, etc.
    """

    @property
    def inputs(self) -> "StepColumns":
        return []

    @property
    def outputs(self) -> "StepColumns":
        return []