mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-03 17:29:01 +00:00
add build and dt types for platfrom
This commit is contained in:
parent
cb8a28c128
commit
12858d6d61
2 changed files with 26 additions and 1 deletions
|
@ -77,6 +77,12 @@ class StackBuild(Subcommand):
|
||||||
default="conda",
|
default="conda",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.parser.add_argument(
|
||||||
|
"--platform",
|
||||||
|
type=str,
|
||||||
|
help="Platform to use for the build. Required when using docker as image type, defaults to host if no platform is specified",
|
||||||
|
)
|
||||||
|
|
||||||
def _run_stack_build_command(self, args: argparse.Namespace) -> None:
|
def _run_stack_build_command(self, args: argparse.Namespace) -> None:
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
|
@ -96,6 +102,8 @@ class StackBuild(Subcommand):
|
||||||
available_templates = available_templates_specs()
|
available_templates = available_templates_specs()
|
||||||
for build_config in available_templates:
|
for build_config in available_templates:
|
||||||
if build_config.name == args.template:
|
if build_config.name == args.template:
|
||||||
|
if args.platform:
|
||||||
|
build_config.platform = args.platform
|
||||||
if args.image_type:
|
if args.image_type:
|
||||||
build_config.image_type = args.image_type
|
build_config.image_type = args.image_type
|
||||||
else:
|
else:
|
||||||
|
@ -130,6 +138,15 @@ class StackBuild(Subcommand):
|
||||||
default="conda",
|
default="conda",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
platform = prompt(
|
||||||
|
"> Enter the target platform you want your Llama Stack to be built for: ",
|
||||||
|
validator=Validator.from_callable(
|
||||||
|
lambda x: len(x) > 0,
|
||||||
|
error_message="Platform cannot be empty, please enter a platform",
|
||||||
|
),
|
||||||
|
default="linux/arm64",
|
||||||
|
)
|
||||||
|
|
||||||
cprint(
|
cprint(
|
||||||
textwrap.dedent(
|
textwrap.dedent(
|
||||||
"""
|
"""
|
||||||
|
@ -172,7 +189,10 @@ class StackBuild(Subcommand):
|
||||||
)
|
)
|
||||||
|
|
||||||
build_config = BuildConfig(
|
build_config = BuildConfig(
|
||||||
name=name, image_type=image_type, distribution_spec=distribution_spec
|
name=name,
|
||||||
|
image_type=image_type,
|
||||||
|
distribution_spec=distribution_spec,
|
||||||
|
platform=platform,
|
||||||
)
|
)
|
||||||
self._run_stack_build_command_from_build_config(build_config)
|
self._run_stack_build_command_from_build_config(build_config)
|
||||||
return
|
return
|
||||||
|
|
|
@ -25,6 +25,7 @@ from llama_stack.providers.utils.kvstore.config import KVStoreConfig
|
||||||
|
|
||||||
LLAMA_STACK_BUILD_CONFIG_VERSION = "2"
|
LLAMA_STACK_BUILD_CONFIG_VERSION = "2"
|
||||||
LLAMA_STACK_RUN_CONFIG_VERSION = "2"
|
LLAMA_STACK_RUN_CONFIG_VERSION = "2"
|
||||||
|
LLAMA_STACK_DEFAULT_PLATFORM = "linux/arm64"
|
||||||
|
|
||||||
|
|
||||||
RoutingKey = Union[str, List[str]]
|
RoutingKey = Union[str, List[str]]
|
||||||
|
@ -167,3 +168,7 @@ class BuildConfig(BaseModel):
|
||||||
default="conda",
|
default="conda",
|
||||||
description="Type of package to build (conda | docker | venv)",
|
description="Type of package to build (conda | docker | venv)",
|
||||||
)
|
)
|
||||||
|
platform: str = Field(
|
||||||
|
default=LLAMA_STACK_DEFAULT_PLATFORM,
|
||||||
|
description="The platform for docker image, defaults to linux/arm64",
|
||||||
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue