mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 15:23:51 +00:00
update configure to only consume config
This commit is contained in:
parent
987e1cafc4
commit
6aa44805c2
4 changed files with 13 additions and 36 deletions
|
@ -38,42 +38,15 @@ class StackConfigure(Subcommand):
|
||||||
|
|
||||||
allowed_ids = [d.distribution_type for d in available_distribution_specs()]
|
allowed_ids = [d.distribution_type for d in available_distribution_specs()]
|
||||||
self.parser.add_argument(
|
self.parser.add_argument(
|
||||||
"--distribution",
|
"config",
|
||||||
type=str,
|
type=str,
|
||||||
help='Distribution ("adhoc" or one of: {})'.format(allowed_ids),
|
help="Path to the package config file (e.g. ~/.llama/builds/<distribution>/<image_type>/<name>.yaml)",
|
||||||
)
|
|
||||||
self.parser.add_argument(
|
|
||||||
"--name",
|
|
||||||
type=str,
|
|
||||||
help="Name of the build",
|
|
||||||
)
|
|
||||||
self.parser.add_argument(
|
|
||||||
"--image-type",
|
|
||||||
type=str,
|
|
||||||
default="conda",
|
|
||||||
choices=[v.value for v in ImageType],
|
|
||||||
)
|
|
||||||
self.parser.add_argument(
|
|
||||||
"--config",
|
|
||||||
type=str,
|
|
||||||
help="Path to a config file to use for the build",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None:
|
def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None:
|
||||||
from llama_toolchain.core.package import ImageType
|
from llama_toolchain.core.package import ImageType
|
||||||
|
|
||||||
if args.config:
|
config_file = Path(args.config)
|
||||||
with open(args.config, "r") as f:
|
|
||||||
build_config = BuildConfig(**yaml.safe_load(f))
|
|
||||||
image_type = ImageType(build_config.image_type)
|
|
||||||
distribution = build_config.distribution
|
|
||||||
name = build_config.name
|
|
||||||
else:
|
|
||||||
image_type = ImageType(args.image_type)
|
|
||||||
name = args.name
|
|
||||||
distribution = args.distribution
|
|
||||||
|
|
||||||
config_file = BUILDS_BASE_DIR / distribution / image_type.value / f"{name}.yaml"
|
|
||||||
if not config_file.exists():
|
if not config_file.exists():
|
||||||
self.parser.error(
|
self.parser.error(
|
||||||
f"Could not find {config_file}. Please run `llama stack build` first"
|
f"Could not find {config_file}. Please run `llama stack build` first"
|
||||||
|
|
|
@ -19,7 +19,7 @@ fi
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [ "$#" -ne 3 ]; then
|
if [ "$#" -ne 4 ]; then
|
||||||
echo "Usage: $0 <distribution_type> <build_name> <pip_dependencies>" >&2
|
echo "Usage: $0 <distribution_type> <build_name> <pip_dependencies>" >&2
|
||||||
echo "Example: $0 <distribution_type> mybuild 'numpy pandas scipy'" >&2
|
echo "Example: $0 <distribution_type> mybuild 'numpy pandas scipy'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -28,7 +28,8 @@ fi
|
||||||
distribution_type="$1"
|
distribution_type="$1"
|
||||||
build_name="$2"
|
build_name="$2"
|
||||||
env_name="llamastack-$build_name"
|
env_name="llamastack-$build_name"
|
||||||
pip_dependencies="$3"
|
config_file="$3"
|
||||||
|
pip_dependencies="$4"
|
||||||
|
|
||||||
# Define color codes
|
# Define color codes
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
|
@ -117,4 +118,4 @@ ensure_conda_env_python310 "$env_name" "$pip_dependencies"
|
||||||
|
|
||||||
printf "${GREEN}Successfully setup conda environment. Configuring build...${NC}\n"
|
printf "${GREEN}Successfully setup conda environment. Configuring build...${NC}\n"
|
||||||
|
|
||||||
$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure --distribution $distribution_type --name "$build_name" --image-type conda
|
$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $config_file
|
||||||
|
|
|
@ -4,7 +4,7 @@ LLAMA_MODELS_DIR=${LLAMA_MODELS_DIR:-}
|
||||||
LLAMA_TOOLCHAIN_DIR=${LLAMA_TOOLCHAIN_DIR:-}
|
LLAMA_TOOLCHAIN_DIR=${LLAMA_TOOLCHAIN_DIR:-}
|
||||||
TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
|
TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
|
||||||
|
|
||||||
if [ "$#" -ne 4 ]; then
|
if [ "$#" -ne 5 ]; then
|
||||||
echo "Usage: $0 <distribution_type> <build_name> <docker_base> <pip_dependencies>
|
echo "Usage: $0 <distribution_type> <build_name> <docker_base> <pip_dependencies>
|
||||||
echo "Example: $0 distribution_type my-fastapi-app python:3.9-slim 'fastapi uvicorn'
|
echo "Example: $0 distribution_type my-fastapi-app python:3.9-slim 'fastapi uvicorn'
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -14,7 +14,8 @@ distribution_type=$1
|
||||||
build_name="$2"
|
build_name="$2"
|
||||||
image_name="llamastack-$build_name"
|
image_name="llamastack-$build_name"
|
||||||
docker_base=$3
|
docker_base=$3
|
||||||
pip_dependencies=$4
|
config_file=$4
|
||||||
|
pip_dependencies=$5
|
||||||
|
|
||||||
# Define color codes
|
# Define color codes
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
|
@ -110,4 +111,4 @@ set +x
|
||||||
printf "${GREEN}Succesfully setup Podman image. Configuring build...${NC}"
|
printf "${GREEN}Succesfully setup Podman image. Configuring build...${NC}"
|
||||||
echo "You can run it with: podman run -p 8000:8000 $image_name"
|
echo "You can run it with: podman run -p 8000:8000 $image_name"
|
||||||
|
|
||||||
$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure --distribution $distribution_type --name "$build_name" --package-type container
|
$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $config_file
|
||||||
|
|
|
@ -119,6 +119,7 @@ def build_package(
|
||||||
distribution_type,
|
distribution_type,
|
||||||
package_name,
|
package_name,
|
||||||
package_deps.docker_image,
|
package_deps.docker_image,
|
||||||
|
str(package_file),
|
||||||
" ".join(package_deps.pip_packages),
|
" ".join(package_deps.pip_packages),
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
|
@ -129,6 +130,7 @@ def build_package(
|
||||||
script,
|
script,
|
||||||
distribution_type,
|
distribution_type,
|
||||||
package_name,
|
package_name,
|
||||||
|
str(package_file),
|
||||||
" ".join(package_deps.pip_packages),
|
" ".join(package_deps.pip_packages),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue