vllm.distributed.weight_transfer.factory ¶
Factory for weight transfer engines with lazy loading.
Classes:
-
WeightTransferEngineFactory–Factory for creating weight transfer engines with lazy loading.
WeightTransferEngineFactory ¶
Factory for creating weight transfer engines with lazy loading.
This factory implements a registry pattern that supports: - Lazy loading: Engine modules are only imported when actually needed - Extensibility: Custom engines can be registered at runtime - Centralized registration: All built-in engines registered in one place
Methods:
-
create_engine–Create a weight transfer engine instance.
-
register_engine–Register an engine with lazy-loading or direct class reference.
Source code in vllm/distributed/weight_transfer/factory.py
create_engine(config, parallel_config, model) classmethod ¶
Create a weight transfer engine instance.
Parameters:
-
(config¶WeightTransferConfig) –Weight transfer configuration containing the backend name
-
(parallel_config¶ParallelConfig) –Parallel configuration for the engine
-
(model¶Module) –The local model instance which will receive the weights
Returns:
-
WeightTransferEngine–An initialized weight transfer engine instance
Raises:
-
ValueError–If the backend is not registered
Source code in vllm/distributed/weight_transfer/factory.py
register_engine(name, module_path_or_cls, class_name=None) classmethod ¶
Register an engine with lazy-loading or direct class reference.
Supports two calling conventions: 1. Lazy loading: register_engine(name, module_path, class_name) 2. Direct class: register_engine(name, engine_cls)
Parameters:
-
(name¶str) –The name to register the engine under (e.g., "nccl")
-
(module_path_or_cls¶str | type[WeightTransferEngine]) –Either a module path string for lazy loading, or the engine class directly
-
(class_name¶str | None, default:None) –Name of the engine class (required if module_path is string)
Raises:
-
ValueError–If an engine with the same name is already registered