kikocis/llama-stack public
Changesets · Branches · Tags · Compare
| Changeset | 5ede92d96ce67479ff90a00d310a2f16e440fe13fa8e9cbcf3a222123a1bcb38 |
|---|---|
| Author | Hardik Shah <hjshah@fb.com> · 2024-09-19 23:26 -07:00 |
| Committer | Hardik Shah <hjshah@fb.com> · 2024-09-19 23:39 -07:00 |
| Parents | a0b7f9866747 |
1 file changed
modified llama_stack/cli/stack/configure.py +13 −13
| @@ -39,18 +39,16 @@ | ||
| 39 | 39 | ) |
| 40 | 40 | |
| 41 | 41 | def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None: |
| 42 | - import json | |
| 43 | 42 | import os |
| 44 | 43 | from pathlib import Path |
| 45 | 44 | |
| 46 | 45 | import pkg_resources |
| 47 | 46 | |
| 48 | 47 | import yaml |
| 48 | + from termcolor import cprint | |
| 49 | 49 | |
| 50 | 50 | from llama_stack.distribution.build import ImageType |
| 51 | - | |
| 52 | 51 | from llama_stack.distribution.utils.exec import run_with_pty |
| 53 | - from termcolor import cprint | |
| 54 | 52 | |
| 55 | 53 | docker_image = None |
| 56 | 54 | |
| @@ -67,15 +65,18 @@ | ||
| 67 | 65 | f"Could not find {build_config_file}. Trying conda build name instead...", |
| 68 | 66 | color="green", |
| 69 | 67 | ) |
| 70 | - conda_dir = Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}" | |
| 71 | - build_config_file = Path(conda_dir) / f"{args.config}-build.yaml" | |
| 68 | + if os.getenv("CONDA_PREFIX"): | |
| 69 | + conda_dir = ( | |
| 70 | + Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}" | |
| 71 | + ) | |
| 72 | + build_config_file = Path(conda_dir) / f"{args.config}-build.yaml" | |
| 72 | 73 | |
| 73 | - if build_config_file.exists(): | |
| 74 | - with open(build_config_file, "r") as f: | |
| 75 | - build_config = BuildConfig(**yaml.safe_load(f)) | |
| 74 | + if build_config_file.exists(): | |
| 75 | + with open(build_config_file, "r") as f: | |
| 76 | + build_config = BuildConfig(**yaml.safe_load(f)) | |
| 76 | 77 | |
| 77 | - self._configure_llama_distribution(build_config, args.output_dir) | |
| 78 | - return | |
| 78 | + self._configure_llama_distribution(build_config, args.output_dir) | |
| 79 | + return | |
| 79 | 80 | |
| 80 | 81 | # if we get here, we need to try to find the docker image |
| 81 | 82 | cprint( |
| @@ -120,11 +121,10 @@ | ||
| 120 | 121 | from pathlib import Path |
| 121 | 122 | |
| 122 | 123 | import yaml |
| 123 | - from llama_stack.distribution.configure import configure_api_providers | |
| 124 | + from termcolor import cprint | |
| 124 | 125 | |
| 125 | - from llama_stack.distribution.utils.exec import run_with_pty | |
| 126 | + from llama_stack.distribution.configure import configure_api_providers | |
| 126 | 127 | from llama_stack.distribution.utils.serialize import EnumEncoder |
| 127 | - from termcolor import cprint | |
| 128 | 128 | |
| 129 | 129 | builds_dir = BUILDS_BASE_DIR / build_config.image_type |
| 130 | 130 | if output_dir: |