kikocis/llama-stack public
Changesets · Branches · Tags · Compare
| Changeset | c69662d961074b8339b3653622fd86f32704beb01ec67455fa1453628cc1efd0 |
|---|---|
| Author | Xi Yan <xiyan@meta.com> · 2024-09-11 11:39 -07:00 |
| Committer | GitHub <noreply@github.com> · 2024-09-11 11:39 -07:00 |
| Parents | 32ac8e99b31d |
8 files changed
modified docs/cli_reference.md +36 −7
| @@ -295,13 +295,18 @@ | ||
| 295 | 295 | Let's imagine you are working with a 8B-Instruct model. The following command will build a package (in the form of a Conda environment) _and_ configure it. As part of the configuration, you will be asked for some inputs (model_id, max_seq_len, etc.) Since we are working with a 8B model, we will name our build `8b-instruct` to help us remember the config. |
| 296 | 296 | |
| 297 | 297 | ``` |
| 298 | -llama stack build local --name 8b-instruct | |
| 298 | +llama stack build | |
| 299 | 299 | ``` |
| 300 | 300 | |
| 301 | -Once it runs successfully , you should see some outputs in the form: | |
| 301 | +Once it runs, you will be prompted to enter build name and optional arguments, and should see some outputs in the form: | |
| 302 | 302 | |
| 303 | 303 | ``` |
| 304 | -$ llama stack build local --name 8b-instruct | |
| 304 | +$ llama stack build | |
| 305 | +Enter value for name (required): 8b-instruct | |
| 306 | +Enter value for distribution (default: local) (required): local | |
| 307 | +Enter value for api_providers (optional): | |
| 308 | +Enter value for image_type (default: conda) (required): | |
| 309 | + | |
| 305 | 310 | .... |
| 306 | 311 | .... |
| 307 | 312 | Successfully installed cfgv-3.4.0 distlib-0.3.8 identify-2.6.0 libcst-1.4.0 llama_toolchain-0.0.2 moreorless-0.4.0 nodeenv-1.9.1 pre-commit-3.8.0 stdlibs-2024.5.15 toml-0.10.2 tomlkit-0.13.0 trailrunner-1.4.0 ufmt-2.7.0 usort-1.0.8 virtualenv-20.26.3 |
| @@ -312,17 +317,41 @@ | ||
| 312 | 317 | ... |
| 313 | 318 | |
| 314 | 319 | YAML configuration has been written to ~/.llama/builds/local/conda/8b-instruct.yaml |
| 320 | +Target `8b-test` built with configuration at /home/xiyan/.llama/builds/local/conda/8b-test.yaml | |
| 321 | +Build spec configuration saved at /home/xiyan/.llama/distributions/local/conda/8b-test-build.yaml | |
| 322 | +``` | |
| 323 | + | |
| 324 | +You can re-build package based on build config | |
| 325 | +``` | |
| 326 | +$ cat ~/.llama/distributions/local/conda/8b-instruct-build.yaml | |
| 327 | +name: 8b-instruct | |
| 328 | +distribution: local | |
| 329 | +api_providers: null | |
| 330 | +image_type: conda | |
| 331 | + | |
| 332 | +$ llama stack build --config ~/.llama/distributions/local/conda/8b-instruct-build.yaml | |
| 333 | + | |
| 334 | +Successfully setup conda environment. Configuring build... | |
| 335 | + | |
| 336 | +... | |
| 337 | +... | |
| 338 | + | |
| 339 | +YAML configuration has been written to ~/.llama/builds/local/conda/8b-instruct.yaml | |
| 340 | +Target `8b-instruct` built with configuration at ~/.llama/builds/local/conda/8b-instruct.yaml | |
| 341 | +Build spec configuration saved at ~/.llama/distributions/local/conda/8b-instruct-build.yaml | |
| 315 | 342 | ``` |
| 343 | + | |
| 316 | 344 | ### Step 3.3: Configure a distribution |
| 317 | 345 | |
| 318 | 346 | You can re-configure this distribution by running: |
| 319 | 347 | ``` |
| 320 | -llama stack configure local --name 8b-instruct | |
| 348 | +llama stack configure ~/.llama/builds/local/conda/8b-instruct.yaml | |
| 321 | 349 | ``` |
| 322 | 350 | |
| 323 | 351 | Here is an example run of how the CLI will guide you to fill the configuration |
| 352 | + | |
| 324 | 353 | ``` |
| 325 | -$ llama stack configure local --name 8b-instruct | |
| 354 | +$ llama stack configure ~/.llama/builds/local/conda/8b-instruct.yaml | |
| 326 | 355 | |
| 327 | 356 | Configuring API: inference (meta-reference) |
| 328 | 357 | Enter value for model (required): Meta-Llama3.1-8B-Instruct |
| @@ -363,12 +392,12 @@ | ||
| 363 | 392 | You need the YAML configuration file which was written out at the end by the `llama stack build` step. |
| 364 | 393 | |
| 365 | 394 | ``` |
| 366 | -llama stack run local --name 8b-instruct --port 5000 | |
| 395 | +llama stack run ~/.llama/builds/local/conda/8b-instruct.yaml --port 5000 | |
| 367 | 396 | ``` |
| 368 | 397 | You should see the Stack server start and print the APIs that it is supporting, |
| 369 | 398 | |
| 370 | 399 | ``` |
| 371 | -$ llama stack run local --name 8b-instruct --port 5000 | |
| 400 | +$ llama stack run ~/.llama/builds/local/conda/8b-instruct.yaml --port 5000 | |
| 372 | 401 | |
| 373 | 402 | > initializing model parallel with size 1 |
| 374 | 403 | > initializing ddp with size 1 |
modified llama_toolchain/cli/stack/build.py +69 −41
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | |
| 9 | 9 | from llama_toolchain.cli.subcommand import Subcommand |
| 10 | 10 | from llama_toolchain.core.datatypes import * # noqa: F403 |
| 11 | +import yaml | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | def parse_api_provider_tuples( |
| @@ -47,55 +48,45 @@ | ||
| 47 | 48 | self.parser.set_defaults(func=self._run_stack_build_command) |
| 48 | 49 | |
| 49 | 50 | def _add_arguments(self): |
| 50 | - from llama_toolchain.core.distribution_registry import available_distribution_specs | |
| 51 | - from llama_toolchain.core.package import ( | |
| 52 | - BuildType, | |
| 51 | + from llama_toolchain.core.distribution_registry import ( | |
| 52 | + available_distribution_specs, | |
| 53 | 53 | ) |
| 54 | + from llama_toolchain.core.package import ImageType | |
| 54 | 55 | |
| 55 | 56 | allowed_ids = [d.distribution_type for d in available_distribution_specs()] |
| 56 | 57 | self.parser.add_argument( |
| 57 | - "distribution", | |
| 58 | + "--config", | |
| 58 | 59 | type=str, |
| 59 | - help="Distribution to build (either \"adhoc\" OR one of: {})".format(allowed_ids), | |
| 60 | - ) | |
| 61 | - self.parser.add_argument( | |
| 62 | - "api_providers", | |
| 63 | - nargs='?', | |
| 64 | - help="Comma separated list of (api=provider) tuples", | |
| 65 | - ) | |
| 66 | - | |
| 67 | - self.parser.add_argument( | |
| 68 | - "--name", | |
| 69 | - type=str, | |
| 70 | - help="Name of the build target (image, conda env)", | |
| 71 | - required=True, | |
| 72 | - ) | |
| 73 | - self.parser.add_argument( | |
| 74 | - "--type", | |
| 75 | - type=str, | |
| 76 | - default="conda_env", | |
| 77 | - choices=[v.value for v in BuildType], | |
| 60 | + help="Path to a config file to use for the build", | |
| 78 | 61 | ) |
| 79 | 62 | |
| 80 | - def _run_stack_build_command(self, args: argparse.Namespace) -> None: | |
| 63 | + def _run_stack_build_command_from_build_config( | |
| 64 | + self, build_config: BuildConfig | |
| 65 | + ) -> None: | |
| 66 | + import json | |
| 67 | + import os | |
| 68 | + | |
| 69 | + from llama_toolchain.common.config_dirs import DISTRIBS_BASE_DIR | |
| 70 | + from llama_toolchain.common.serialize import EnumEncoder | |
| 81 | 71 | from llama_toolchain.core.distribution_registry import resolve_distribution_spec |
| 82 | - from llama_toolchain.core.package import ( | |
| 83 | - ApiInput, | |
| 84 | - BuildType, | |
| 85 | - build_package, | |
| 86 | - ) | |
| 72 | + from llama_toolchain.core.package import ApiInput, build_package, ImageType | |
| 73 | + from termcolor import cprint | |
| 87 | 74 | |
| 88 | 75 | api_inputs = [] |
| 89 | - if args.distribution == "adhoc": | |
| 90 | - if not args.api_providers: | |
| 91 | - self.parser.error("You must specify API providers with (api=provider,...) for building an adhoc distribution") | |
| 76 | + if build_config.distribution == "adhoc": | |
| 77 | + if not build_config.api_providers: | |
| 78 | + self.parser.error( | |
| 79 | + "You must specify API providers with (api=provider,...) for building an adhoc distribution" | |
| 80 | + ) | |
| 92 | 81 | return |
| 93 | 82 | |
| 94 | - parsed = parse_api_provider_tuples(args.api_providers, self.parser) | |
| 83 | + parsed = parse_api_provider_tuples(build_config.api_providers, self.parser) | |
| 95 | 84 | for api, provider_spec in parsed.items(): |
| 96 | 85 | for dep in provider_spec.api_dependencies: |
| 97 | 86 | if dep not in parsed: |
| 98 | - self.parser.error(f"API {api} needs dependency {dep} provided also") | |
| 87 | + self.parser.error( | |
| 88 | + f"API {api} needs dependency {dep} provided also" | |
| 89 | + ) | |
| 99 | 90 | return |
| 100 | 91 | |
| 101 | 92 | api_inputs.append( |
| @@ -106,13 +97,17 @@ | ||
| 106 | 97 | ) |
| 107 | 98 | docker_image = None |
| 108 | 99 | else: |
| 109 | - if args.api_providers: | |
| 110 | - self.parser.error("You cannot specify API providers for pre-registered distributions") | |
| 100 | + if build_config.api_providers: | |
| 101 | + self.parser.error( | |
| 102 | + "You cannot specify API providers for pre-registered distributions" | |
| 103 | + ) | |
| 111 | 104 | return |
| 112 | 105 | |
| 113 | - dist = resolve_distribution_spec(args.distribution) | |
| 106 | + dist = resolve_distribution_spec(build_config.distribution) | |
| 114 | 107 | if dist is None: |
| 115 | - self.parser.error(f"Could not find distribution {args.distribution}") | |
| 108 | + self.parser.error( | |
| 109 | + f"Could not find distribution {build_config.distribution}" | |
| 110 | + ) | |
| 116 | 111 | return |
| 117 | 112 | |
| 118 | 113 | for api, provider_type in dist.providers.items(): |
| @@ -126,8 +121,41 @@ | ||
| 126 | 121 | |
| 127 | 122 | build_package( |
| 128 | 123 | api_inputs, |
| 129 | - build_type=BuildType(args.type), | |
| 130 | - name=args.name, | |
| 131 | - distribution_type=args.distribution, | |
| 124 | + image_type=ImageType(build_config.image_type), | |
| 125 | + name=build_config.name, | |
| 126 | + distribution_type=build_config.distribution, | |
| 132 | 127 | docker_image=docker_image, |
| 133 | 128 | ) |
| 129 | + | |
| 130 | + # save build.yaml spec for building same distribution again | |
| 131 | + build_dir = ( | |
| 132 | + DISTRIBS_BASE_DIR / build_config.distribution / build_config.image_type | |
| 133 | + ) | |
| 134 | + os.makedirs(build_dir, exist_ok=True) | |
| 135 | + build_file_path = build_dir / f"{build_config.name}-build.yaml" | |
| 136 | + | |
| 137 | + with open(build_file_path, "w") as f: | |
| 138 | + to_write = json.loads(json.dumps(build_config.dict(), cls=EnumEncoder)) | |
| 139 | + f.write(yaml.dump(to_write, sort_keys=False)) | |
| 140 | + | |
| 141 | + cprint( | |
| 142 | + f"Build spec configuration saved at {str(build_file_path)}", | |
| 143 | + color="green", | |
| 144 | + ) | |
| 145 | + | |
| 146 | + def _run_stack_build_command(self, args: argparse.Namespace) -> None: | |
| 147 | + from llama_toolchain.common.prompt_for_config import prompt_for_config | |
| 148 | + from llama_toolchain.core.dynamic import instantiate_class_type | |
| 149 | + | |
| 150 | + if args.config: | |
| 151 | + with open(args.config, "r") as f: | |
| 152 | + try: | |
| 153 | + build_config = BuildConfig(**yaml.safe_load(f)) | |
| 154 | + except Exception as e: | |
| 155 | + self.parser.error(f"Could not parse config file {args.config}: {e}") | |
| 156 | + return | |
| 157 | + self._run_stack_build_command_from_build_config(build_config) | |
| 158 | + return | |
| 159 | + | |
| 160 | + build_config = prompt_for_config(BuildConfig, None) | |
| 161 | + self._run_stack_build_command_from_build_config(build_config) |
modified llama_toolchain/cli/stack/configure.py +7 −26
| @@ -9,10 +9,10 @@ | ||
| 9 | 9 | from pathlib import Path |
| 10 | 10 | |
| 11 | 11 | import yaml |
| 12 | -from termcolor import cprint | |
| 13 | 12 | |
| 14 | 13 | from llama_toolchain.cli.subcommand import Subcommand |
| 15 | 14 | from llama_toolchain.common.config_dirs import BUILDS_BASE_DIR |
| 15 | +from termcolor import cprint | |
| 16 | 16 | from llama_toolchain.core.datatypes import * # noqa: F403 |
| 17 | 17 | |
| 18 | 18 | |
| @@ -34,38 +34,19 @@ | ||
| 34 | 34 | from llama_toolchain.core.distribution_registry import ( |
| 35 | 35 | available_distribution_specs, |
| 36 | 36 | ) |
| 37 | - from llama_toolchain.core.package import BuildType | |
| 37 | + from llama_toolchain.core.package import ImageType | |
| 38 | 38 | |
| 39 | 39 | allowed_ids = [d.distribution_type for d in available_distribution_specs()] |
| 40 | 40 | self.parser.add_argument( |
| 41 | - "distribution", | |
| 42 | - type=str, | |
| 43 | - help='Distribution ("adhoc" or one of: {})'.format(allowed_ids), | |
| 44 | - ) | |
| 45 | - self.parser.add_argument( | |
| 46 | - "--name", | |
| 41 | + "config", | |
| 47 | 42 | type=str, |
| 48 | - help="Name of the build", | |
| 49 | - required=True, | |
| 50 | - ) | |
| 51 | - self.parser.add_argument( | |
| 52 | - "--type", | |
| 53 | - type=str, | |
| 54 | - default="conda_env", | |
| 55 | - choices=[v.value for v in BuildType], | |
| 43 | + help="Path to the package config file (e.g. ~/.llama/builds/<distribution>/<image_type>/<name>.yaml)", | |
| 56 | 44 | ) |
| 57 | 45 | |
| 58 | 46 | def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None: |
| 59 | - from llama_toolchain.core.package import BuildType | |
| 60 | - | |
| 61 | - build_type = BuildType(args.type) | |
| 62 | - name = args.name | |
| 63 | - config_file = ( | |
| 64 | - BUILDS_BASE_DIR | |
| 65 | - / args.distribution | |
| 66 | - / build_type.descriptor() | |
| 67 | - / f"{name}.yaml" | |
| 68 | - ) | |
| 47 | + from llama_toolchain.core.package import ImageType | |
| 48 | + | |
| 49 | + config_file = Path(args.config) | |
| 69 | 50 | if not config_file.exists(): |
| 70 | 51 | self.parser.error( |
| 71 | 52 | f"Could not find {config_file}. Please run `llama stack build` first" |
modified llama_toolchain/cli/stack/run.py +8 −19
| @@ -29,24 +29,12 @@ | ||
| 29 | 29 | self.parser.set_defaults(func=self._run_stack_run_cmd) |
| 30 | 30 | |
| 31 | 31 | def _add_arguments(self): |
| 32 | - from llama_toolchain.core.package import BuildType | |
| 32 | + from llama_toolchain.core.package import ImageType | |
| 33 | 33 | |
| 34 | 34 | self.parser.add_argument( |
| 35 | - "distribution", | |
| 35 | + "config", | |
| 36 | 36 | type=str, |
| 37 | - help="Distribution whose build you want to start", | |
| 38 | - ) | |
| 39 | - self.parser.add_argument( | |
| 40 | - "--name", | |
| 41 | - type=str, | |
| 42 | - help="Name of the build you want to start", | |
| 43 | - required=True, | |
| 44 | - ) | |
| 45 | - self.parser.add_argument( | |
| 46 | - "--type", | |
| 47 | - type=str, | |
| 48 | - default="conda_env", | |
| 49 | - choices=[v.value for v in BuildType], | |
| 37 | + help="Path to config file to use for the run", | |
| 50 | 38 | ) |
| 51 | 39 | self.parser.add_argument( |
| 52 | 40 | "--port", |
| @@ -63,12 +51,13 @@ | ||
| 63 | 51 | |
| 64 | 52 | def _run_stack_run_cmd(self, args: argparse.Namespace) -> None: |
| 65 | 53 | from llama_toolchain.common.exec import run_with_pty |
| 66 | - from llama_toolchain.core.package import BuildType | |
| 54 | + from llama_toolchain.core.package import ImageType | |
| 67 | 55 | |
| 68 | - build_type = BuildType(args.type) | |
| 69 | - build_dir = BUILDS_BASE_DIR / args.distribution / build_type.descriptor() | |
| 70 | - path = build_dir / f"{args.name}.yaml" | |
| 56 | + if not args.config: | |
| 57 | + self.parser.error("Must specify a config file to run") | |
| 58 | + return | |
| 71 | 59 | |
| 60 | + path = args.config | |
| 72 | 61 | config_file = Path(path) |
| 73 | 62 | |
| 74 | 63 | if not config_file.exists(): |
modified llama_toolchain/core/build_conda_env.sh +4 −3
| @@ -19,7 +19,7 @@ | ||
| 19 | 19 | |
| 20 | 20 | set -euo pipefail |
| 21 | 21 | |
| 22 | -if [ "$#" -ne 3 ]; then | |
| 22 | +if [ "$#" -ne 4 ]; then | |
| 23 | 23 | echo "Usage: $0 <distribution_type> <build_name> <pip_dependencies>" >&2 |
| 24 | 24 | echo "Example: $0 <distribution_type> mybuild 'numpy pandas scipy'" >&2 |
| 25 | 25 | exit 1 |
| @@ -28,7 +28,8 @@ | ||
| 28 | 28 | distribution_type="$1" |
| 29 | 29 | build_name="$2" |
| 30 | 30 | env_name="llamastack-$build_name" |
| 31 | -pip_dependencies="$3" | |
| 31 | +config_file="$3" | |
| 32 | +pip_dependencies="$4" | |
| 32 | 33 | |
| 33 | 34 | # Define color codes |
| 34 | 35 | RED='\033[0;31m' |
| @@ -117,4 +118,4 @@ | ||
| 117 | 118 | |
| 118 | 119 | printf "${GREEN}Successfully setup conda environment. Configuring build...${NC}\n" |
| 119 | 120 | |
| 120 | -$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $distribution_type --name "$build_name" --type conda_env | |
| 121 | +$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $config_file |
modified llama_toolchain/core/build_container.sh +4 −3
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | LLAMA_TOOLCHAIN_DIR=${LLAMA_TOOLCHAIN_DIR:-} |
| 5 | 5 | TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-} |
| 6 | 6 | |
| 7 | -if [ "$#" -ne 4 ]; then | |
| 7 | +if [ "$#" -ne 5 ]; then | |
| 8 | 8 | echo "Usage: $0 <distribution_type> <build_name> <docker_base> <pip_dependencies> |
| 9 | 9 | echo "Example: $0 distribution_type my-fastapi-app python:3.9-slim 'fastapi uvicorn' |
| 10 | 10 | exit 1 |
| @@ -14,7 +14,8 @@ | ||
| 14 | 14 | build_name="$2" |
| 15 | 15 | image_name="llamastack-$build_name" |
| 16 | 16 | docker_base=$3 |
| 17 | -pip_dependencies=$4 | |
| 17 | +config_file=$4 | |
| 18 | +pip_dependencies=$5 | |
| 18 | 19 | |
| 19 | 20 | # Define color codes |
| 20 | 21 | RED='\033[0;31m' |
| @@ -110,4 +111,4 @@ | ||
| 110 | 111 | printf "${GREEN}Succesfully setup Podman image. Configuring build...${NC}" |
| 111 | 112 | echo "You can run it with: podman run -p 8000:8000 $image_name" |
| 112 | 113 | |
| 113 | -$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $distribution_type --name "$build_name" --type container | |
| 114 | +$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $config_file |
modified llama_toolchain/core/datatypes.py +16 −0
| @@ -188,3 +188,19 @@ | ||
| 188 | 188 | the dependencies of these providers as well. |
| 189 | 189 | """, |
| 190 | 190 | ) |
| 191 | + | |
| 192 | + | |
| 193 | +@json_schema_type | |
| 194 | +class BuildConfig(BaseModel): | |
| 195 | + name: str | |
| 196 | + distribution: str = Field( | |
| 197 | + default="local", description="Type of distribution to build (adhoc | {})" | |
| 198 | + ) | |
| 199 | + api_providers: Optional[str] = Field( | |
| 200 | + default_factory=list, | |
| 201 | + description="List of API provider names to build", | |
| 202 | + ) | |
| 203 | + image_type: str = Field( | |
| 204 | + default="conda", | |
| 205 | + description="Type of package to build (conda | container)", | |
| 206 | + ) |
modified llama_toolchain/core/package.py +13 −14
| @@ -12,24 +12,21 @@ | ||
| 12 | 12 | |
| 13 | 13 | import pkg_resources |
| 14 | 14 | import yaml |
| 15 | -from pydantic import BaseModel | |
| 16 | - | |
| 17 | -from termcolor import cprint | |
| 18 | 15 | |
| 19 | 16 | from llama_toolchain.common.config_dirs import BUILDS_BASE_DIR |
| 20 | 17 | from llama_toolchain.common.exec import run_with_pty |
| 21 | 18 | from llama_toolchain.common.serialize import EnumEncoder |
| 19 | +from pydantic import BaseModel | |
| 20 | + | |
| 21 | +from termcolor import cprint | |
| 22 | 22 | |
| 23 | 23 | from llama_toolchain.core.datatypes import * # noqa: F403 |
| 24 | 24 | from llama_toolchain.core.distribution import api_providers, SERVER_DEPENDENCIES |
| 25 | 25 | |
| 26 | 26 | |
| 27 | -class BuildType(Enum): | |
| 28 | - container = "container" | |
| 29 | - conda_env = "conda_env" | |
| 30 | - | |
| 31 | - def descriptor(self) -> str: | |
| 32 | - return "docker" if self == self.container else "conda" | |
| 27 | +class ImageType(Enum): | |
| 28 | + docker = "docker" | |
| 29 | + conda = "conda" | |
| 33 | 30 | |
| 34 | 31 | |
| 35 | 32 | class Dependencies(BaseModel): |
| @@ -44,7 +41,7 @@ | ||
| 44 | 41 | |
| 45 | 42 | def build_package( |
| 46 | 43 | api_inputs: List[ApiInput], |
| 47 | - build_type: BuildType, | |
| 44 | + image_type: ImageType, | |
| 48 | 45 | name: str, |
| 49 | 46 | distribution_type: Optional[str] = None, |
| 50 | 47 | docker_image: Optional[str] = None, |
| @@ -52,7 +49,7 @@ | ||
| 52 | 49 | if not distribution_type: |
| 53 | 50 | distribution_type = "adhoc" |
| 54 | 51 | |
| 55 | - build_dir = BUILDS_BASE_DIR / distribution_type / build_type.descriptor() | |
| 52 | + build_dir = BUILDS_BASE_DIR / distribution_type / image_type.value | |
| 56 | 53 | os.makedirs(build_dir, exist_ok=True) |
| 57 | 54 | |
| 58 | 55 | package_name = name.replace("::", "-") |
| @@ -106,14 +103,14 @@ | ||
| 106 | 103 | ) |
| 107 | 104 | |
| 108 | 105 | c.distribution_type = distribution_type |
| 109 | - c.docker_image = package_name if build_type == BuildType.container else None | |
| 110 | - c.conda_env = package_name if build_type == BuildType.conda_env else None | |
| 106 | + c.docker_image = package_name if image_type == ImageType.docker else None | |
| 107 | + c.conda_env = package_name if image_type == ImageType.conda else None | |
| 111 | 108 | |
| 112 | 109 | with open(package_file, "w") as f: |
| 113 | 110 | to_write = json.loads(json.dumps(c.dict(), cls=EnumEncoder)) |
| 114 | 111 | f.write(yaml.dump(to_write, sort_keys=False)) |
| 115 | 112 | |
| 116 | - if build_type == BuildType.container: | |
| 113 | + if image_type == ImageType.docker: | |
| 117 | 114 | script = pkg_resources.resource_filename( |
| 118 | 115 | "llama_toolchain", "core/build_container.sh" |
| 119 | 116 | ) |
| @@ -122,6 +119,7 @@ | ||
| 122 | 119 | distribution_type, |
| 123 | 120 | package_name, |
| 124 | 121 | package_deps.docker_image, |
| 122 | + str(package_file), | |
| 125 | 123 | " ".join(package_deps.pip_packages), |
| 126 | 124 | ] |
| 127 | 125 | else: |
| @@ -132,6 +130,7 @@ | ||
| 132 | 130 | script, |
| 133 | 131 | distribution_type, |
| 134 | 132 | package_name, |
| 133 | + str(package_file), | |
| 135 | 134 | " ".join(package_deps.pip_packages), |
| 136 | 135 | ] |
| 137 | 136 |