vllm.distributed.ec_transfer.ec_connector.example_connector
¶
Classes:
ECExampleConnector
¶
Bases: ECConnectorBase
Methods:
-
build_connector_meta–Build the connector metadata for this step.
-
has_cache_item–Check if cache exist externally for the media.
-
request_finished–Report each item's cache key and grid so a consumer can skip the
-
save_caches–Save the encoder cache to the connector.
-
start_load_caches–Start loading the cache from the connector into vLLM's encoder cache.
-
update_state_after_alloc–Update ECConnector state after encoder cache allocation.
_found_match_for_mm_data(mm_hash)
¶
Check if the cache is hit for the request.
_generate_filename_debug(mm_hash, create_folder=True)
¶
Return the full path of the safetensors file for this mm_hash.
If create_folder is True (default) the parent directory is created.
_generate_foldername_debug(mm_hash, create_folder=True)
¶
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.
build_connector_meta(scheduler_output)
¶
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.
has_cache_item(identifier)
¶
request_finished(request)
¶
Report each item's cache key and grid so a consumer can skip the image transform.
A consumer only needs the grid to size the prompt's placeholder range; the embedding itself arrives through this connector. Reporting the grid the producer actually computed keeps the two sides in agreement without the caller re-deriving it from the raw media.
save_caches(encoder_cache, mm_hash, **kwargs)
¶
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:
start_load_caches(encoder_cache, **kwargs)
¶
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:
update_state_after_alloc(request, index)
¶
Update ECConnector state after encoder cache allocation.