kikocis/llama-stack public
Changesets · Branches · Tags · Compare
| Changeset | 30e129e4a270cf26e0c87d6b7d1ca88a8521f797a8f9419f3bb4f4005b4c70b7 |
|---|---|
| Author | Xi Yan <xiyan@meta.com> · 2024-09-18 15:35 -07:00 |
| Committer | Xi Yan <xiyan@meta.com> · 2024-09-18 15:35 -07:00 |
| Parents | 6abed3f4fe33 |
2 files changed
modified docs/getting_started.md +52 −41
| @@ -28,6 +28,7 @@ | ||
| 28 | 28 | ``` |
| 29 | 29 | |
| 30 | 30 | **`llama stack configure`** |
| 31 | +- Run `llama stack configure <name>` with the name you have previously defined in `build` step. | |
| 31 | 32 | ``` |
| 32 | 33 | llama stack configure my-local-llama-stack |
| 33 | 34 | |
| @@ -61,6 +62,7 @@ | ||
| 61 | 62 | ``` |
| 62 | 63 | |
| 63 | 64 | **`llama stack run`** |
| 65 | +- Run `llama stack run <name>` with the name you have previously defined. | |
| 64 | 66 | ``` |
| 65 | 67 | llama stack run my-local-llama-stack |
| 66 | 68 | |
| @@ -110,74 +112,83 @@ | ||
| 110 | 112 | - `providers`: specifies the underlying implementation for serving each API endpoint |
| 111 | 113 | - `image_type`: `conda` | `docker` to specify whether to build the distribution in the form of Docker image or Conda environment. |
| 112 | 114 | |
| 113 | -#### Build a local distribution with conda | |
| 114 | -The following command and specifications allows you to get started with building. | |
| 115 | + | |
| 116 | +At the end of build command, we will generate `<name>-build.yaml` file storing the build configurations. | |
| 117 | + | |
| 118 | +#### Building from scratch | |
| 119 | +- For a new user, we could start off with running `llama stack build` which will allow you to a interactively enter wizard where you will be prompted to enter build configurations. | |
| 115 | 120 | ``` |
| 116 | -llama stack build <path/to/config> | |
| 121 | +llama stack build | |
| 117 | 122 | ``` |
| 118 | -- You will be required to pass in a file path to the build.config file (e.g. `./llama_stack/distribution/example_configs/conda/local-conda-example-build.yaml`). We provide some example build config files for configuring different types of distributions in the `./llama_stack/distribution/example_configs/` folder. | |
| 119 | 123 | |
| 120 | -The file will be of the contents | |
| 124 | +Running the command above will allow you to fill in the configuration to build your Llama Stack distribution, you will see the following outputs. | |
| 125 | + | |
| 121 | 126 | ``` |
| 122 | -$ cat ./llama_stack/distribution/example_configs/conda/local-conda-example-build.yaml | |
| 127 | +> Enter an unique name for identifying your Llama Stack build distribution (e.g. my-local-stack): my-local-llama-stack | |
| 128 | +> Enter the image type you want your distribution to be built with (docker or conda): conda | |
| 123 | 129 | |
| 124 | -name: 8b-instruct | |
| 125 | -distribution_spec: | |
| 126 | - distribution_type: local | |
| 127 | - description: Use code from `llama_stack` itself to serve all llama stack APIs | |
| 128 | - docker_image: null | |
| 129 | - providers: | |
| 130 | - inference: meta-reference | |
| 131 | - memory: meta-reference-faiss | |
| 132 | - safety: meta-reference | |
| 133 | - agentic_system: meta-reference | |
| 134 | - telemetry: console | |
| 135 | -image_type: conda | |
| 130 | + Llama Stack is composed of several APIs working together. Let's configure the providers (implementations) you want to use for these APIs. | |
| 131 | +> Enter the API provider for the inference API: (default=meta-reference): meta-reference | |
| 132 | +> Enter the API provider for the safety API: (default=meta-reference): meta-reference | |
| 133 | +> Enter the API provider for the agents API: (default=meta-reference): meta-reference | |
| 134 | +> Enter the API provider for the memory API: (default=meta-reference): meta-reference | |
| 135 | +> Enter the API provider for the telemetry API: (default=meta-reference): meta-reference | |
| 136 | + | |
| 137 | + > (Optional) Enter a short description for your Llama Stack distribution: | |
| 138 | + | |
| 139 | +Build spec configuration saved at ~/.conda/envs/llamastack-my-local-llama-stack/my-local-llama-stack-build.yaml | |
| 140 | +``` | |
| 141 | + | |
| 142 | +#### Building from templates | |
| 143 | +- To build from alternative API providers, we provide distribution templates for users to get started building a distribution backed by different providers. | |
| 144 | + | |
| 145 | +The following command will allow you to see the available templates and their corresponding providers. | |
| 136 | 146 | ``` |
| 147 | +llama stack build --list-templates | |
| 148 | +``` | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | +You may then pick a template to build your distribution with providers fitted to your liking. | |
| 137 | 153 | |
| 138 | -You may run the `llama stack build` command to generate your distribution with `--name` to override the name for your distribution. | |
| 139 | 154 | ``` |
| 140 | -$ llama stack build ~/.llama/distributions/conda/8b-instruct-build.yaml --name 8b-instruct | |
| 141 | -... | |
| 142 | -... | |
| 143 | -Build spec configuration saved at ~/.llama/distributions/conda/8b-instruct-build.yaml | |
| 155 | +llama stack build --template local-tgi --name my-tgi-stack | |
| 144 | 156 | ``` |
| 145 | 157 | |
| 146 | -After this step is complete, a file named `8b-instruct-build.yaml` will be generated and saved at `~/.llama/distributions/conda/8b-instruct-build.yaml`. | |
| 158 | +``` | |
| 159 | + | |
| 160 | +``` | |
| 147 | 161 | |
| 162 | +#### Building from config file | |
| 163 | +- In addition to templates, you may customize the build to your liking through editing config files and build from config files with the following command. | |
| 148 | 164 | |
| 149 | -#### How to build distribution with different API providers using configs | |
| 150 | -To specify a different API provider, we can change the `distribution_spec` in our `<name>-build.yaml` config. For example, the following build spec allows you to build a distribution using TGI as the inference API provider. | |
| 165 | +- The config file will be of contents like the ones in `llama_stack/distributions/templates/`. | |
| 151 | 166 | |
| 152 | 167 | ``` |
| 153 | -$ cat ./llama_stack/distribution/example_configs/conda/local-tgi-conda-example-build.yaml | |
| 168 | +$ cat llama_stack/distribution/templates/local-ollama-build.yaml | |
| 154 | 169 | |
| 155 | -name: local-tgi-conda-example | |
| 170 | +name: local-ollama | |
| 156 | 171 | distribution_spec: |
| 157 | - description: Use TGI (local or with Hugging Face Inference Endpoints for running LLM inference. When using HF Inference Endpoints, you must provide the name of the endpoint). | |
| 158 | - docker_image: null | |
| 172 | + description: Like local, but use ollama for running LLM inference | |
| 159 | 173 | providers: |
| 160 | - inference: remote::tgi | |
| 161 | - memory: meta-reference-faiss | |
| 174 | + inference: remote::ollama | |
| 175 | + memory: meta-reference | |
| 162 | 176 | safety: meta-reference |
| 163 | - agentic_system: meta-reference | |
| 164 | - telemetry: console | |
| 177 | + agents: meta-reference | |
| 178 | + telemetry: meta-reference | |
| 165 | 179 | image_type: conda |
| 166 | 180 | ``` |
| 167 | 181 | |
| 168 | -The following command allows you to build a distribution with TGI as the inference API provider, with the name `tgi`. | |
| 169 | 182 | ``` |
| 170 | -llama stack build ./llama_stack/distribution/example_configs/conda/local-tgi-conda-example-build.yaml --name tgi | |
| 183 | +llama stack build --config llama_stack/distribution/templates/local-ollama-build.yaml | |
| 171 | 184 | ``` |
| 172 | 185 | |
| 173 | -We provide some example build configs to help you get started with building with different API providers. | |
| 186 | +After this step is complete, a file named `8b-instruct-build.yaml` will be generated and saved at `~/.llama/distributions/conda/8b-instruct-build.yaml`. | |
| 174 | 187 | |
| 175 | 188 | #### How to build distribution with Docker image |
| 176 | 189 | To build a docker image, simply change the `image_type` to `docker` in our `<name>-build.yaml` file, and run `llama stack build <name>-build.yaml`. |
| 177 | 190 | |
| 178 | 191 | ``` |
| 179 | -$ cat ./llama_stack/distribution/example_configs/docker/local-docker-example-build.yaml | |
| 180 | - | |
| 181 | 192 | name: local-docker-example |
| 182 | 193 | distribution_spec: |
| 183 | 194 | description: Use code from `llama_stack` itself to serve all llama stack APIs |
| @@ -206,7 +217,7 @@ | ||
| 206 | 217 | ## Step 2. Configure |
| 207 | 218 | After our distribution is built (either in form of docker or conda environment), we will run the following command to |
| 208 | 219 | ``` |
| 209 | -llama stack configure [<path/to/name.build.yaml> | <docker-image-name>] | |
| 220 | +llama stack configure [ <name> | <docker-image-name> | <path/to/name.build.yaml>] | |
| 210 | 221 | ``` |
| 211 | 222 | - For `conda` environments: <path/to/name.build.yaml> would be the generated build spec saved from Step 1. |
| 212 | 223 | - For `docker` images downloaded from Dockerhub, you could also use <docker-image-name> as the argument. |
| @@ -298,7 +309,7 @@ | ||
| 298 | 309 | ``` |
| 299 | 310 | |
| 300 | 311 | > [!NOTE] |
| 301 | -> Configuration is in `~/.llama/builds/local/conda/8b-instruct.yaml`. Feel free to increase `max_seq_len`. | |
| 312 | +> Configuration is in `~/.llama/builds/local/conda/8b-instruct-run.yaml`. Feel free to increase `max_seq_len`. | |
| 302 | 313 | |
| 303 | 314 | > [!IMPORTANT] |
| 304 | 315 | > The "local" distribution inference server currently only supports CUDA. It will not work on Apple Silicon machines. |
added docs/list-templates.png +0 −0
Binary content is not shown. View the file.