vllm.distributed.ec_transfer.ec_connector.encoder_output_width
¶
Encoder output widths for sizing EC transfers.
An encoder can emit features wider than the LM embedding (DeepStack packs several layers on the last dim) by an amount only the model knows. Producers size transfers before the first real item is encoded, so the engine measures the width once at startup by encoding a dummy item per modality.
Functions:
-
get_encoder_output_width–Encoder output width for
modality, as measured at producer startup. -
measure_encoder_output_widths–Record the encoder output widths on an EC producer's config.
_measure_on_worker(worker)
¶
Encode one dummy item per modality; runs on every worker.
Returns {} on ranks that hold no encoder.
Source code in vllm/distributed/ec_transfer/ec_connector/encoder_output_width.py
get_encoder_output_width(vllm_config, modality)
¶
Encoder output width for modality, as measured at producer startup.
Raises:
-
ValueError–No width was measured for
modality, so a transfer cannot be sized.
Source code in vllm/distributed/ec_transfer/ec_connector/encoder_output_width.py
measure_encoder_output_widths(vllm_config, collective_rpc)
¶
Record the encoder output widths on an EC producer's config.
Call after the model is loaded and before the KV cache is allocated: the Scheduler's connector reads the widths, and once the KV cache holds the memory budget there is no room left for a dummy encode.
Raises:
-
ValueError–No worker could encode a dummy item, or workers disagree.