vllm.distributed.weight_transfer.base ¶
Base class for weight transfer engines.
WeightTransferEngine ¶
Bases: ABC, Generic[TInitInfo, TUpdateInfo]
Base class for weight transfer engines that handle transport of model weights from a trainer to inference workers.
This abstraction separates weight transfer transport logic from the worker implementation, allowing different backends (NCCL, CUDA IPC[TODO], RDMA[TODO]) to be plugged in.
Subclasses should define
init_info_cls: Type of backend-specific initialization info update_info_cls: Type of backend-specific update info
Source code in vllm/distributed/weight_transfer/base.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
__init__ ¶
__init__(
config: WeightTransferConfig,
parallel_config: ParallelConfig,
) -> None
Initialize the weight transfer engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | WeightTransferConfig | The configuration for the weight transfer engine | required |
parallel_config | ParallelConfig | The configuration for the parallel setup | required |
Source code in vllm/distributed/weight_transfer/base.py
init_transfer_engine abstractmethod ¶
Initialize the weight transfer mechanism. This is called once at the beginning of training.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_info | TInitInfo | Backend-specific initialization info | required |
Source code in vllm/distributed/weight_transfer/base.py
parse_init_info ¶
Construct typed init info from dict with validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_dict | dict[str, Any] | Dictionary containing backend-specific initialization parameters | required |
Returns:
| Type | Description |
|---|---|
TInitInfo | Typed backend-specific init info dataclass |
Raises:
| Type | Description |
|---|---|
ValueError | If init_dict is invalid for this backend |
Source code in vllm/distributed/weight_transfer/base.py
parse_update_info ¶
Construct typed update info from dict with validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update_dict | dict[str, Any] | Dictionary containing backend-specific update parameters | required |
Returns:
| Type | Description |
|---|---|
TUpdateInfo | Typed backend-specific update info dataclass |
Raises:
| Type | Description |
|---|---|
ValueError | If update_dict is invalid for this backend |
Source code in vllm/distributed/weight_transfer/base.py
receive_weights abstractmethod ¶
receive_weights(
update_info: TUpdateInfo,
load_weights: Callable[
[list[tuple[str, Tensor]]], None
],
) -> None
Receive weights from the trainer and load them incrementally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update_info | TUpdateInfo | Backend-specific update info containing parameter metadata and any backend-specific data | required |
load_weights | Callable[[list[tuple[str, Tensor]]], None] | Callable that loads weights into the model. Called incrementally for each weight to avoid OOM. | required |
Source code in vllm/distributed/weight_transfer/base.py
shutdown abstractmethod ¶
Shutdown the weight transfer engine. This should be called when the worker is shutting down.
WeightTransferInitInfo dataclass ¶
WeightTransferInitRequest dataclass ¶
WeightTransferUpdateInfo dataclass ¶
Bases: ABC
Base class for backend-specific weight update info.