fastvideo.v1.models.loader.component_loader
#
Module Contents#
Classes#
Base class for loading a specific type of model component. |
|
Generic loader for components that don’t have a specific loader. |
|
Loader for image processor. |
|
Utility class for loading pipeline components. This replaces the chain of if-else statements in load_pipeline_module. |
|
Loader for scheduler. |
|
Loader for text encoders. |
|
Loader for tokenizers. |
|
Loader for transformer. |
|
Loader for VAE. |
Data#
API#
- class fastvideo.v1.models.loader.component_loader.ComponentLoader(device=None)[source]#
Bases:
abc.ABC
Base class for loading a specific type of model component.
Initialization
- classmethod for_module_type(module_type: str, transformers_or_diffusers: str) fastvideo.v1.models.loader.component_loader.ComponentLoader [source]#
Factory method to create a component loader for a specific module type.
- Parameters:
module_type – Type of module (e.g., “vae”, “text_encoder”, “transformer”, “scheduler”)
transformers_or_diffusers – Whether the module is from transformers or diffusers
- Returns:
A component loader for the specified module type
- abstract load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the component based on the model path, architecture, and inference args.
- Parameters:
model_path – Path to the component model
architecture – Architecture of the component model
fastvideo_args – Inference arguments
- Returns:
The loaded component
- class fastvideo.v1.models.loader.component_loader.GenericComponentLoader(library='transformers')[source]#
Bases:
fastvideo.v1.models.loader.component_loader.ComponentLoader
Generic loader for components that don’t have a specific loader.
Initialization
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load a generic component based on the model path, architecture, and inference args.
- class fastvideo.v1.models.loader.component_loader.ImageEncoderLoader(device=None)[source]#
Bases:
fastvideo.v1.models.loader.component_loader.TextEncoderLoader
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the text encoders based on the model path, architecture, and inference args.
- class fastvideo.v1.models.loader.component_loader.ImageProcessorLoader(device=None)[source]#
Bases:
fastvideo.v1.models.loader.component_loader.ComponentLoader
Loader for image processor.
Initialization
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the image processor based on the model path, architecture, and inference args.
- class fastvideo.v1.models.loader.component_loader.PipelineComponentLoader[source]#
Utility class for loading pipeline components. This replaces the chain of if-else statements in load_pipeline_module.
- static load_module(module_name: str, component_model_path: str, transformers_or_diffusers: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load a pipeline module.
- Parameters:
module_name – Name of the module (e.g., “vae”, “text_encoder”, “transformer”, “scheduler”)
component_model_path – Path to the component model
transformers_or_diffusers – Whether the module is from transformers or diffusers
architecture – Architecture of the component model
fastvideo_args – Inference arguments
- Returns:
The loaded module
- class fastvideo.v1.models.loader.component_loader.SchedulerLoader(device=None)[source]#
Bases:
fastvideo.v1.models.loader.component_loader.ComponentLoader
Loader for scheduler.
Initialization
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the scheduler based on the model path, architecture, and inference args.
- class fastvideo.v1.models.loader.component_loader.TextEncoderLoader(device=None)[source]#
Bases:
fastvideo.v1.models.loader.component_loader.ComponentLoader
Loader for text encoders.
Initialization
- class Source[source]#
A source for weights.
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the text encoders based on the model path, architecture, and inference args.
- load_model(model_path: str, model_config, target_device: torch.device, dtype: str = 'fp16')[source]#
- class fastvideo.v1.models.loader.component_loader.TokenizerLoader(device=None)[source]#
Bases:
fastvideo.v1.models.loader.component_loader.ComponentLoader
Loader for tokenizers.
Initialization
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the tokenizer based on the model path, architecture, and inference args.
- class fastvideo.v1.models.loader.component_loader.TransformerLoader(device=None)[source]#
Bases:
fastvideo.v1.models.loader.component_loader.ComponentLoader
Loader for transformer.
Initialization
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the transformer based on the model path, architecture, and inference args.
- class fastvideo.v1.models.loader.component_loader.VAELoader(device=None)[source]#
Bases:
fastvideo.v1.models.loader.component_loader.ComponentLoader
Loader for VAE.
Initialization
- load(model_path: str, architecture: str, fastvideo_args: fastvideo.v1.fastvideo_args.FastVideoArgs)[source]#
Load the VAE based on the model path, architecture, and inference args.