vllm.distributed.ec_transfer.ec_connector.shared_storage_connector ¶
ECSharedStorageConnector ¶
Bases: ECConnectorBase
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
45 46 47 48 49 50 51 52 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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
_storage_path instance-attribute ¶
__init__ ¶
__init__(vllm_config: VllmConfig, role: ECConnectorRole)
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
_found_match_for_mm_data ¶
_found_match_for_mm_data(mm_hash) -> bool
Check if the cache is hit for the request.
_generate_filename_debug ¶
Return the full path of the safetensors file for this mm_hash. Ensures the parent directory exists because _generate_foldername_debug is called with its default (create_folder=True).
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
_generate_foldername_debug ¶
Return the folder in which the cache for this mm_hash lives. If create_folder is True (default) the directory is created recursively the first time it is needed.
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
build_connector_meta ¶
build_connector_meta(
scheduler_output: SchedulerOutput,
) -> ECConnectorMetadata
Build the connector metadata for this step.
This function should NOT modify any fields in the scheduler_output. Also, calling this function will reset the state of the connector. This only build for load mm_data only Args: scheduler_output (SchedulerOutput): the scheduler output object.
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
has_caches ¶
Check if cache exist externally for each mm_data of request
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request | Request | the request object. | required |
Returns:
| Type | Description |
|---|---|
list[bool] | List of bool indicate that ith mm_data exist in cache or not |
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
save_caches ¶
Save the encoder cache to the connector.
This method saves the encoder cache from the worker's local storage to shared storage or another external connector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encoder_cache | dict[str, Tensor] | A dictionary mapping multimodal data hashes ( | required |
mm_hash | str | The hash of the multimodal data whose cache is being saved. | required |
kwargs | dict | Additional keyword arguments for the connector. | {} |
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
start_load_caches ¶
Start loading the cache from the connector into vLLM's encoder cache.
This method loads the encoder cache based on metadata provided by the scheduler. It is called before _gather_mm_embeddings for the EC Connector. For EC, the encoder_cache and mm_hash are stored in kwargs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encoder_cache | dict[str, Tensor] | A dictionary mapping multimodal data hashes ( | required |
kwargs | dict | Additional keyword arguments for the connector. | {} |
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
update_state_after_alloc ¶
Update ECConnector state after encoder cache allocation.
Source code in vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py
ECSharedStorageConnectorMetadata dataclass ¶
Bases: ECConnectorMetadata