fastvideo.v1.pipelines.composed_pipeline_base#

Base class for composed pipelines.

This module defines the base class for pipelines that are composed of multiple stages.

Module Contents#

Classes#

ComposedPipelineBase

Base class for pipelines composed of multiple stages.

Data#

API#

class fastvideo.v1.pipelines.composed_pipeline_base.ComposedPipelineBase(model_path: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs, config: Optional[Dict[str, Any]] = None, required_config_modules: Optional[List[str]] = None)[source]#

Bases: abc.ABC

Base class for pipelines composed of multiple stages.

This class provides the framework for creating pipelines by composing multiple stages together. Each stage is responsible for a specific part of the diffusion process, and the pipeline orchestrates the execution of these stages.

Initialization

Initialize the pipeline. After init, the pipeline should be ready to use. The pipeline should be stateless and not hold any batch state.

add_module(module_name: str, module: Any)[source]#
add_stage(stage_name: str, stage: fastvideo.v1.pipelines.stages.PipelineStage)[source]#
abstract create_pipeline_stages(fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#

Create the pipeline stages.

abstract create_training_stages(training_args: fastvideo.v1.fastvideo_args.TrainingArgs)[source]#

Create the training pipeline stages.

fastvideo_args: Optional[fastvideo.v1.fastvideo_args.FastVideoArgs][source]#

None

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

Generate a video or image using the pipeline.

Parameters:
  • batch – The batch to generate from.

  • fastvideo_args – The inference arguments.

Returns:

The batch with the generated video or image.

Return type:

ForwardBatch

classmethod from_pretrained(model_path: str, device: Optional[str] = None, torch_dtype: Optional[torch.dtype] = None, pipeline_config: Optional[Union[str | fastvideo.v1.configs.pipelines.PipelineConfig]] = None, args: Optional[argparse.Namespace] = None, required_config_modules: Optional[List[str]] = None, **kwargs) fastvideo.v1.pipelines.composed_pipeline_base.ComposedPipelineBase[source]#
get_module(module_name: str, default_value: Any = None) Any[source]#
initialize_pipeline(fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#

Initialize the pipeline.

abstract initialize_training_pipeline(training_args: fastvideo.v1.fastvideo_args.TrainingArgs)[source]#
abstract initialize_validation_pipeline(training_args: fastvideo.v1.fastvideo_args.TrainingArgs)[source]#
is_video_pipeline: bool[source]#

False

load_modules(fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs) Dict[str, Any][source]#

Load the modules from the config.

maybe_init_distributed_environment(fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
property required_config_modules: List[str][source]#

List of modules that are required by the pipeline. The names should match the diffusers directory and model_index.json file. These modules will be loaded using the PipelineComponentLoader and made available in the modules dictionary. Access these modules using the get_module method.

class ConcretePipeline(ComposedPipelineBase): _required_config_modules = [“vae”, “text_encoder”, “transformer”, “scheduler”, “tokenizer”]

@property
def required_config_modules(self):
    return self._required_config_modules
property stages: List[fastvideo.v1.pipelines.stages.PipelineStage][source]#

List of stages in the pipeline.

training_args: Optional[fastvideo.v1.fastvideo_args.TrainingArgs][source]#

None

fastvideo.v1.pipelines.composed_pipeline_base.logger[source]#

‘init_logger(…)’