mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 10:54:19 +00:00
Use new definitions of Model / SKU
This commit is contained in:
parent
156bfa0e15
commit
09cf3fe78b
8 changed files with 63 additions and 65 deletions
|
@ -9,7 +9,7 @@ import json
|
|||
|
||||
from enum import Enum
|
||||
|
||||
from llama_models.sku_list import llama3_1_model_list
|
||||
from llama_models.sku_list import resolve_model
|
||||
|
||||
from termcolor import colored
|
||||
|
||||
|
@ -47,20 +47,13 @@ class ModelDescribe(Subcommand):
|
|||
)
|
||||
|
||||
def _run_model_describe_cmd(self, args: argparse.Namespace) -> None:
|
||||
models = llama3_1_model_list()
|
||||
by_id = {model.sku.value: model for model in models}
|
||||
|
||||
if args.model_id not in by_id:
|
||||
print(
|
||||
model = resolve_model(args.model_id)
|
||||
if model is None:
|
||||
self.parser.error(
|
||||
f"Model {args.model_id} not found; try 'llama model list' for a list of available models."
|
||||
)
|
||||
return
|
||||
|
||||
model = by_id[args.model_id]
|
||||
|
||||
sampling_params = model.recommended_sampling_params.dict()
|
||||
for k in ("max_tokens", "repetition_penalty"):
|
||||
del sampling_params[k]
|
||||
rows = [
|
||||
(
|
||||
colored("Model", "white", attrs=["bold"]),
|
||||
|
@ -70,13 +63,20 @@ class ModelDescribe(Subcommand):
|
|||
("Description", model.description_markdown),
|
||||
("Context Length", f"{model.max_seq_length // 1024}K tokens"),
|
||||
("Weights format", model.quantization_format.value),
|
||||
(
|
||||
"Recommended sampling params",
|
||||
json.dumps(sampling_params, cls=EnumEncoder, indent=4),
|
||||
),
|
||||
("Model params.json", json.dumps(model.model_args, indent=4)),
|
||||
]
|
||||
|
||||
if model.recommended_sampling_params is not None:
|
||||
sampling_params = model.recommended_sampling_params.dict()
|
||||
for k in ("max_tokens", "repetition_penalty"):
|
||||
del sampling_params[k]
|
||||
rows.append(
|
||||
(
|
||||
"Recommended sampling params",
|
||||
json.dumps(sampling_params, cls=EnumEncoder, indent=4),
|
||||
)
|
||||
)
|
||||
|
||||
print_table(
|
||||
rows,
|
||||
separate_rows=True,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue