[Feature] Get Token IDs with Engine.generate() (#2636)

Co-authored-by: Chayenne <zhaochen20@outlook.com>
This commit is contained in:
Shi Shuai
2024-12-29 12:28:27 -08:00
committed by GitHub
co-authored by Chayenne
parent b085e06b01
commit 35bdb48557
7 changed files with 92 additions and 2 deletions
+7
View File
@@ -54,6 +54,7 @@ class ServerArgs:
chat_template: Optional[str] = None
is_embedding: bool = False
revision: Optional[str] = None
return_token_ids: bool = False
# Port for the HTTP server
host: str = "127.0.0.1"
@@ -280,6 +281,12 @@ class ServerArgs:
action="store_true",
help="If set, skip init tokenizer and pass input_ids in generate request",
)
parser.add_argument(
"--return-token-ids",
action="store_true",
default=ServerArgs.return_token_ids,
help="Whether to return token IDs in the output, this may introduce additional overhead.",
)
parser.add_argument(
"--load-format",
type=str,