[Frontend] Add reusable TP1 initialized-engine snapshots (#51360)

Signed-off-by: Nils Matteson <nilsmatteson@icloud.com>
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Co-authored-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
Co-authored-by: elehayym <52448798+Yuzu23@users.noreply.github.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Nils Matteson
2026-09-21 23:18:49 +00:00
committed by GitHub
co-authored by Taneem Ibrahim elehayym Andreas Karatzas mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 8bf051cd51
commit 13058faa49
16 changed files with 3773 additions and 10 deletions
+14 -7
View File
@@ -519,7 +519,7 @@ class FlexibleArgumentParser(ArgumentParser):
config_args = self.load_config_file(file_path)
# 0th index might be the sub command {serve,chat,complete,...}
# optionally followed by model_tag (only for serve)
# optionally followed by model_tag (serve or snapshot create)
# followed by config args
# followed by rest of cli args.
# maintaining this order will enforce the precedence
@@ -527,8 +527,11 @@ class FlexibleArgumentParser(ArgumentParser):
if args[0].startswith("-"):
# No sub command (e.g., api_server entry point)
args = config_args + args[0:index] + args[index + 2 :]
elif args[0] == "serve":
model_in_cli = len(args) > 1 and not args[1].startswith("-")
elif args[0] == "serve" or args[:2] == ["snapshot", "create"]:
model_index = 1 if args[0] == "serve" else 2
model_in_cli = len(args) > model_index and not args[model_index].startswith(
"-"
)
model_in_config = any(arg == "--model" for arg in config_args)
if not model_in_cli and not model_in_config:
@@ -540,15 +543,19 @@ class FlexibleArgumentParser(ArgumentParser):
if model_in_cli:
# Model specified as positional arg, keep CLI version
args = (
[args[0]]
+ [args[1]]
args[: model_index + 1]
+ config_args
+ args[2:index]
+ args[model_index + 1 : index]
+ args[index + 2 :]
)
else:
# No model in CLI, use config if available
args = [args[0]] + config_args + args[1:index] + args[index + 2 :]
args = (
args[:model_index]
+ config_args
+ args[model_index:index]
+ args[index + 2 :]
)
else:
args = [args[0]] + config_args + args[1:index] + args[index + 2 :]