fastvideo.v1.pipelines.stages.base#

Base classes for pipeline stages.

This module defines the abstract base classes for pipeline stages that can be composed to create complete diffusion pipelines.

Module Contents#

Classes#

PipelineStage

Abstract base class for all pipeline stages.

Data#

API#

class fastvideo.v1.pipelines.stages.base.PipelineStage[source]#

Bases: abc.ABC

Abstract base class for all pipeline stages.

A pipeline stage represents a discrete step in the diffusion process that can be composed with other stages to create a complete pipeline. Each stage is responsible for a specific part of the process, such as prompt encoding, latent preparation, etc.

abstract backward(batch: fastvideo.v1.pipelines.pipeline_batch_info.ForwardBatch, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs) fastvideo.v1.pipelines.pipeline_batch_info.ForwardBatch[source]#
property device: torch.device[source]#

Get the device for this stage.

abstract forward(batch: fastvideo.v1.pipelines.pipeline_batch_info.ForwardBatch, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs) fastvideo.v1.pipelines.pipeline_batch_info.ForwardBatch[source]#

Forward pass of the stage’s processing.

This method should be implemented by subclasses to provide the forward processing logic for the stage.

Parameters:
  • batch – The current batch information.

  • fastvideo_args – The inference arguments.

Returns:

The updated batch information after this stage’s processing.

set_logging(enable: bool)[source]#

Enable or disable logging for this stage.

Parameters:

enable – Whether to enable logging.

verify_input(batch: fastvideo.v1.pipelines.pipeline_batch_info.ForwardBatch, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs) fastvideo.v1.pipelines.stages.validators.VerificationResult[source]#

Verify the input for the stage.

.. rubric:: Example

from fastvideo.v1.pipelines.stages.validators import V, VerificationResult

def verify_input(self, batch, fastvideo_args): result = VerificationResult() result.add_check(“height”, batch.height, V.positive_int_divisible(8)) result.add_check(“width”, batch.width, V.positive_int_divisible(8)) result.add_check(“image_latent”, batch.image_latent, V.is_tensor) return result

Parameters:
  • batch – The current batch information.

  • fastvideo_args – The inference arguments.

Returns:

A VerificationResult containing the verification status.

verify_output(batch: fastvideo.v1.pipelines.pipeline_batch_info.ForwardBatch, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs) fastvideo.v1.pipelines.stages.validators.VerificationResult[source]#

Verify the output for the stage.

Parameters:
  • batch – The current batch information.

  • fastvideo_args – The inference arguments.

Returns:

A VerificationResult containing the verification status.

exception fastvideo.v1.pipelines.stages.base.StageVerificationError[source]#

Bases: Exception

Exception raised when stage verification fails.

Initialization

Initialize self. See help(type(self)) for accurate signature.

fastvideo.v1.pipelines.stages.base.logger[source]#

‘init_logger(…)’