feat: support EPD disaggregation (#12263)
Co-authored-by: liusy58 <liusy58@linux.alibaba.com> Co-authored-by: ZhengWG <zwg0606@gmail.com> Co-authored-by: Nicholas <45984215+liusy58@users.noreply.github.com> Co-authored-by: Shangming Cai <csmthu@gmail.com> Co-authored-by: Yuhao Yang <47235274+yhyang201@users.noreply.github.com>
This commit is contained in:
co-authored by
liusy58
ZhengWG
Nicholas
Shangming Cai
Yuhao Yang
parent
a9ce1623cd
commit
9acb21ae27
@@ -137,6 +137,8 @@ LORA_BACKEND_CHOICES = ["triton", "csgmv", "ascend", "torch_native"]
|
||||
|
||||
DISAGG_TRANSFER_BACKEND_CHOICES = ["mooncake", "nixl", "ascend", "fake"]
|
||||
|
||||
ENCODER_TRANSFER_BACKEND_CHOICES = ["zmq_to_scheduler", "zmq_to_tokenizer", "mooncake"]
|
||||
|
||||
GRAMMAR_BACKEND_CHOICES = ["xgrammar", "outlines", "llguidance", "none"]
|
||||
|
||||
DETERMINISTIC_ATTENTION_BACKEND_CHOICES = ["flashinfer", "fa3", "triton"]
|
||||
@@ -269,6 +271,12 @@ class ServerArgs:
|
||||
nccl_port: Optional[int] = None
|
||||
checkpoint_engine_wait_weights_before_ready: bool = False
|
||||
|
||||
# Encode prefill disaggregation
|
||||
encoder_only: bool = False
|
||||
language_only: bool = False
|
||||
encoder_transfer_backend: str = ENCODER_TRANSFER_BACKEND_CHOICES[0]
|
||||
encoder_urls: List[str] = dataclasses.field(default_factory=list)
|
||||
|
||||
# Quantization and data type
|
||||
dtype: str = "auto"
|
||||
quantization: Optional[str] = None
|
||||
@@ -607,6 +615,7 @@ class ServerArgs:
|
||||
mm_max_concurrent_calls: int = 32
|
||||
mm_per_request_timeout: float = 10.0
|
||||
enable_broadcast_mm_inputs_process: bool = False
|
||||
enable_prefix_mm_cache: bool = False
|
||||
mm_enable_dp_encoder: bool = False
|
||||
mm_process_config: Optional[Dict[str, Any]] = None
|
||||
|
||||
@@ -676,7 +685,10 @@ class ServerArgs:
|
||||
self._handle_load_format()
|
||||
|
||||
# Handle PD disaggregation.
|
||||
self._handle_disaggregation()
|
||||
self._handle_pd_disaggregation()
|
||||
|
||||
# Handle Encoder disaggregation.
|
||||
self._handle_encoder_disaggregation()
|
||||
|
||||
# Validate tokenizer settings.
|
||||
self._handle_tokenizer_batching()
|
||||
@@ -1991,7 +2003,30 @@ class ServerArgs:
|
||||
):
|
||||
self.load_format = "auto"
|
||||
|
||||
def _handle_disaggregation(self):
|
||||
def _handle_encoder_disaggregation(self):
|
||||
if self.enable_prefix_mm_cache and not self.encoder_only:
|
||||
raise ValueError(
|
||||
"--enable-prefix-mm-cache requires --encoder-only to be enabled"
|
||||
)
|
||||
if self.encoder_only and self.language_only:
|
||||
raise ValueError("Cannot set --encoder-only and --language-only together")
|
||||
if self.encoder_only and not self.disaggregation_mode == "null":
|
||||
raise ValueError(
|
||||
"Cannot set --encoder-only and --disaggregation-mode prefill/decode together"
|
||||
)
|
||||
if (
|
||||
self.language_only
|
||||
and self.encoder_transfer_backend == "zmq_to_scheduler"
|
||||
and self.pp_size > 1
|
||||
):
|
||||
raise ValueError("zmq_to_scheduler not support pp_size > 1")
|
||||
|
||||
if self.language_only and len(self.encoder_urls) == 0:
|
||||
raise ValueError(
|
||||
"requires at least one encoder urls to be set via --encoder-urls"
|
||||
)
|
||||
|
||||
def _handle_pd_disaggregation(self):
|
||||
if self.disaggregation_mode == "decode":
|
||||
assert (
|
||||
self.disaggregation_decode_tp is None
|
||||
@@ -2396,6 +2431,32 @@ class ServerArgs:
|
||||
"before serving inference requests.",
|
||||
)
|
||||
|
||||
# Encode prefill disaggregation
|
||||
parser.add_argument(
|
||||
"--encoder-only",
|
||||
action="store_true",
|
||||
help="For MLLM with an encoder, launch an encoder-only server",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--language-only",
|
||||
action="store_true",
|
||||
help="For VLM, load weights for the language model only.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--encoder-transfer-backend",
|
||||
type=str,
|
||||
default=ServerArgs.encoder_transfer_backend,
|
||||
choices=ENCODER_TRANSFER_BACKEND_CHOICES,
|
||||
help="The backend for encoder disaggregation transfer. Default is zmq_to_scheduler.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--encoder-urls",
|
||||
nargs="+",
|
||||
type=str,
|
||||
default=[],
|
||||
help="List of encoder server urls.",
|
||||
)
|
||||
|
||||
# Quantization and data type
|
||||
parser.add_argument(
|
||||
"--dtype",
|
||||
@@ -4160,6 +4221,12 @@ class ServerArgs:
|
||||
default=ServerArgs.decrypted_draft_config_file,
|
||||
help="The path of the decrypted draft config file.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--enable-prefix-mm-cache",
|
||||
action="store_true",
|
||||
default=ServerArgs.enable_prefix_mm_cache,
|
||||
help="Enable prefix multimodal cache. Currently only supports mm-only.",
|
||||
)
|
||||
|
||||
# For registering hooks
|
||||
parser.add_argument(
|
||||
|
||||
Reference in New Issue
Block a user