From fab6bd172820227eee4ce210cf41a4b2c06c4fe4 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Mon, 2 Sep 2024 21:36:32 -0700 Subject: [PATCH] Update documentation again and add error messages to llama stack start --- docs/cli_reference.md | 9 +++------ llama_toolchain/cli/stack/start.py | 22 ++++++++++------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/cli_reference.md b/docs/cli_reference.md index 1267a6851..295b9898c 100644 --- a/docs/cli_reference.md +++ b/docs/cli_reference.md @@ -328,7 +328,7 @@ Successfully setup conda environment. Configuring build... ... ... -YAML configuration has been written to ~/.llama/builds/stack/env-local-llama-8b.yaml +YAML configuration has been written to ~/.llama/builds/local/conda/llama-8b.yaml ``` You can re-configure this distribution by running: @@ -358,7 +358,7 @@ Entering sub-configuration for prompt_guard_shield: Enter value for model (required): Prompt-Guard-86M ... ... -YAML configuration has been written to ~/.llama/builds/conda/local/llama-8b.yaml +YAML configuration has been written to ~/.llama/builds/local/conda/llama-8b.yaml ``` As you can see, we did basic configuration above and configured: @@ -378,9 +378,6 @@ You need the YAML configuration file which was written out at the end by the `ll ``` llama stack start local --name llama-8b --port 5000 - -# or you can give the full path of the YAML file -llama stack start ~/.llama/builds/conda/local/llama-8b.yaml --port 5000 ``` You should see the Stack server start and print the APIs that it is supporting, @@ -417,7 +414,7 @@ INFO: Uvicorn running on http://[::]:5000 (Press CTRL+C to quit) > [!NOTE] -> Configuration is in `~/.llama/builds/conda/local/llama-8b.yaml`. Feel free to increase `max_seq_len`. +> Configuration is in `~/.llama/builds/local/conda/llama-8b.yaml`. Feel free to increase `max_seq_len`. > [!IMPORTANT] > The "local" distribution inference server currently only supports CUDA. It will not work on Apple Silicon machines. diff --git a/llama_toolchain/cli/stack/start.py b/llama_toolchain/cli/stack/start.py index fe6288d56..a5f541c95 100644 --- a/llama_toolchain/cli/stack/start.py +++ b/llama_toolchain/cli/stack/start.py @@ -65,25 +65,23 @@ class StackStart(Subcommand): from llama_toolchain.common.exec import run_with_pty from llama_toolchain.core.package import BuildType - if args.name.endswith(".yaml"): - path = args.name - else: - build_type = BuildType(args.type) - build_dir = BUILDS_BASE_DIR / args.distribution / build_type.descriptor() - path = build_dir / f"{args.name}.yaml" + build_type = BuildType(args.type) + build_dir = BUILDS_BASE_DIR / args.distribution / build_type.descriptor() + path = build_dir / f"{args.name}.yaml" config_file = Path(path) + if not config_file.exists(): + self.parser.error( + f"File {str(config_file)} does not exist. Did you run `llama stack build`?" + ) + return + with open(config_file, "r") as f: config = PackageConfig(**yaml.safe_load(f)) if not config.distribution_id: - # this is technically not necessary. everything else continues to work, - # but maybe we want to be very clear for the users - self.parser.error( - "No distribution_id found. Did you want to start a provider?" - ) - return + raise ValueError("Build config appears to be corrupt.") if config.docker_image: script = pkg_resources.resource_filename(