Adding user defined hooks support (#13217)
This commit is contained in:
@@ -22,7 +22,7 @@ import logging
|
||||
import os
|
||||
import random
|
||||
import tempfile
|
||||
from typing import Dict, List, Literal, Optional, Union
|
||||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
|
||||
import orjson
|
||||
|
||||
@@ -391,6 +391,7 @@ class ServerArgs:
|
||||
speculative_token_map: Optional[str] = None
|
||||
speculative_attention_mode: str = "prefill"
|
||||
speculative_moe_runner_backend: Optional[str] = None
|
||||
|
||||
# For ngram only
|
||||
speculative_ngram_min_match_window_size: int = 1
|
||||
speculative_ngram_max_match_window_size: int = 12
|
||||
@@ -577,6 +578,9 @@ class ServerArgs:
|
||||
decrypted_config_file: Optional[str] = None
|
||||
decrypted_draft_config_file: Optional[str] = None
|
||||
|
||||
# For forward hooks
|
||||
hooks: Optional[List[dict[str, Any]]] = None
|
||||
|
||||
def __post_init__(self):
|
||||
"""
|
||||
Orchestrates the handling of various server arguments, ensuring proper configuration and validation.
|
||||
@@ -3725,6 +3729,14 @@ class ServerArgs:
|
||||
help="The path of the decrypted draft config file.",
|
||||
)
|
||||
|
||||
# For registering hooks
|
||||
parser.add_argument(
|
||||
"--hooks",
|
||||
type=json_list_type,
|
||||
default=None,
|
||||
help="The hooks to be attached.",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_cli_args(cls, args: argparse.Namespace):
|
||||
args.tp_size = args.tensor_parallel_size
|
||||
|
||||
Reference in New Issue
Block a user